lock-Solaris-386.s 830 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .section .bss
  2. .align 4
  3. .L4_.bss:
  4. .align 4
  5. Solaris_Asm_IntP: / Offset 0
  6. .type Solaris_Asm_IntP,@object
  7. .size Solaris_Asm_IntP,4
  8. .set .,.+4
  9. Solaris_Asm_VoidP: / Offset 4
  10. .type Solaris_Asm_VoidP,@object
  11. .size Solaris_Asm_VoidP,4
  12. .set .,.+4
  13. .section .data
  14. .align 4
  15. .L2_.data:
  16. .align 4
  17. .L01: .string "canlock corrupted 0x%lux\n\000"
  18. .set .,.+0x2
  19. .section .text
  20. .align 4
  21. .L1_.text:
  22. .align 4
  23. .align 4
  24. .globl canlock
  25. canlock:
  26. pushl %ebp
  27. movl %esp,%ebp
  28. pushl %esi
  29. movl 8(%ebp),%eax
  30. movl %eax,Solaris_Asm_IntP
  31. movl $1, %ecx
  32. xchg (%eax), %ecx
  33. andl %ecx,%ecx
  34. jne .L1
  35. movl $1,%esi
  36. jmp .L2
  37. .align 4
  38. .L3:
  39. subl %esi,%esi
  40. jmp .L2
  41. .align 4
  42. .L1:
  43. cmpl $1,%ecx
  44. je .L3
  45. pushl %ecx
  46. pushl $.L01
  47. call print
  48. addl $8,%esp
  49. .L2:
  50. movl %esi,%eax
  51. popl %esi
  52. leave
  53. ret
  54. .type canlock,@function
  55. .size canlock,.-canlock