lock-Irix-mips.s 265 B

12345678910111213141516171819
  1. #include <sys/regdef.h>
  2. #include <sys/asm.h>
  3. /*
  4. * lock from r4000 book
  5. */
  6. LEAF(canlock)
  7. .set noreorder
  8. 1:
  9. ll t0,0(a0) /* a0 is argument */
  10. or t1, t0, 1
  11. sc t1,0(a0)
  12. beq t1,zero,1b
  13. nop
  14. j $31 /* lock held */
  15. xor v0, t0, 1
  16. .set reorder
  17. END(canlock)