spinlock.S 588 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ;; Core of the spinlock implementation
  2. ;;
  3. ;; Copyright (C) 2004 Axis Communications AB.
  4. ;;
  5. ;; Author: Mikael Starvik
  6. .global cris_spin_lock
  7. .type cris_spin_lock,@function
  8. .global cris_spin_trylock
  9. .type cris_spin_trylock,@function
  10. .text
  11. cris_spin_lock:
  12. clearf p
  13. 1: test.b [$r10]
  14. beq 1b
  15. clearf p
  16. ax
  17. clear.b [$r10]
  18. bcs 1b
  19. clearf p
  20. ret
  21. nop
  22. .size cris_spin_lock, . - cris_spin_lock
  23. cris_spin_trylock:
  24. clearf p
  25. 1: move.b [$r10], $r11
  26. ax
  27. clear.b [$r10]
  28. bcs 1b
  29. clearf p
  30. ret
  31. movu.b $r11,$r10
  32. .size cris_spin_trylock, . - cris_spin_trylock