cmpxchg8b_emu.S 856 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; version 2
  5. * of the License.
  6. *
  7. */
  8. #include <linux/linkage.h>
  9. .text
  10. /*
  11. * Inputs:
  12. * %esi : memory location to compare
  13. * %eax : low 32 bits of old value
  14. * %edx : high 32 bits of old value
  15. * %ebx : low 32 bits of new value
  16. * %ecx : high 32 bits of new value
  17. */
  18. ENTRY(cmpxchg8b_emu)
  19. #
  20. # Emulate 'cmpxchg8b (%esi)' on UP except we don't
  21. # set the whole ZF thing (caller will just compare
  22. # eax:edx with the expected value)
  23. #
  24. pushfl
  25. cli
  26. cmpl (%esi), %eax
  27. jne .Lnot_same
  28. cmpl 4(%esi), %edx
  29. jne .Lhalf_same
  30. movl %ebx, (%esi)
  31. movl %ecx, 4(%esi)
  32. popfl
  33. ret
  34. .Lnot_same:
  35. movl (%esi), %eax
  36. .Lhalf_same:
  37. movl 4(%esi), %edx
  38. popfl
  39. ret
  40. ENDPROC(cmpxchg8b_emu)