2005-07-27 18:44:44 +00:00
|
|
|
;; Core of the spinlock implementation
|
|
|
|
;;
|
|
|
|
;; Copyright (C) 2004 Axis Communications AB.
|
|
|
|
;;
|
|
|
|
;; Author: Mikael Starvik
|
|
|
|
|
|
|
|
|
|
|
|
.global cris_spin_lock
|
2010-08-03 14:18:22 +00:00
|
|
|
.type cris_spin_lock,@function
|
2005-07-27 18:44:44 +00:00
|
|
|
.global cris_spin_trylock
|
2010-08-03 14:18:22 +00:00
|
|
|
.type cris_spin_trylock,@function
|
2005-07-27 18:44:44 +00:00
|
|
|
|
|
|
|
.text
|
|
|
|
|
|
|
|
cris_spin_lock:
|
|
|
|
clearf p
|
2008-01-25 16:57:28 +00:00
|
|
|
1: test.b [$r10]
|
2005-07-27 18:44:44 +00:00
|
|
|
beq 1b
|
|
|
|
clearf p
|
|
|
|
ax
|
2008-01-25 16:57:28 +00:00
|
|
|
clear.b [$r10]
|
2005-07-27 18:44:44 +00:00
|
|
|
bcs 1b
|
|
|
|
clearf p
|
|
|
|
ret
|
|
|
|
nop
|
|
|
|
|
2010-08-03 14:18:22 +00:00
|
|
|
.size cris_spin_lock, . - cris_spin_lock
|
|
|
|
|
2005-07-27 18:44:44 +00:00
|
|
|
cris_spin_trylock:
|
|
|
|
clearf p
|
2008-01-25 16:57:28 +00:00
|
|
|
1: move.b [$r10], $r11
|
2005-07-27 18:44:44 +00:00
|
|
|
ax
|
2008-01-25 16:57:28 +00:00
|
|
|
clear.b [$r10]
|
2005-07-27 18:44:44 +00:00
|
|
|
bcs 1b
|
|
|
|
clearf p
|
|
|
|
ret
|
2008-01-25 16:57:28 +00:00
|
|
|
movu.b $r11,$r10
|
2010-08-03 14:18:22 +00:00
|
|
|
|
|
|
|
.size cris_spin_trylock, . - cris_spin_trylock
|
|
|
|
|