In the x86 version of test-and-set EAX is the return value of the function hence if the lock is not acquired (i.e. dst!=EAX) we expect a return value of dst . If the value in EAX is equal to dst then the src is loaded into dst, and EAX will hold it's old value; the return value in EAX will be it's old value - an indicator that the lock has been acquired.
In the x86 version of test-and-set EAX is the return value of the function hence if the lock is not acquired (i.e. dst!=EAX) we expect a return value of dst . If the value in EAX is equal to dst then the src is loaded into dst, and EAX will hold it's old value; the return value in EAX will be it's old value - an indicator that the lock has been acquired.