lock-Solaris-sparc.s 318 B

1234567891011121314151617181920
  1. .section ".text", #alloc, #execinstr
  2. .align 8
  3. .skip 16
  4. .global canlock
  5. .type canlock,#function
  6. canlock:
  7. or %g0,1,%o1
  8. swap [%o0],%o1 ! o0 points to lock; key is first word
  9. cmp %o1,1
  10. bne .gotit
  11. nop
  12. retl ! key was 1
  13. or %g0,0,%o0
  14. .gotit:
  15. retl ! key was not 1
  16. or %g0,1,%o0
  17. .size canlock,(.-canlock)