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