cmpxchg8b_emu.S 909 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #include <asm/export.h>
  10. .text
  11. /*
  12. * Inputs:
  13. * %esi : memory location to compare
  14. * %eax : low 32 bits of old value
  15. * %edx : high 32 bits of old value
  16. * %ebx : low 32 bits of new value
  17. * %ecx : high 32 bits of new value
  18. */
  19. ENTRY(cmpxchg8b_emu)
  20. #
  21. # Emulate 'cmpxchg8b (%esi)' on UP except we don't
  22. # set the whole ZF thing (caller will just compare
  23. # eax:edx with the expected value)
  24. #
  25. pushfl
  26. cli
  27. cmpl (%esi), %eax
  28. jne .Lnot_same
  29. cmpl 4(%esi), %edx
  30. jne .Lhalf_same
  31. movl %ebx, (%esi)
  32. movl %ecx, 4(%esi)
  33. popfl
  34. ret
  35. .Lnot_same:
  36. movl (%esi), %eax
  37. .Lhalf_same:
  38. movl 4(%esi), %edx
  39. popfl
  40. ret
  41. ENDPROC(cmpxchg8b_emu)
  42. EXPORT_SYMBOL(cmpxchg8b_emu)