blob: 79087ef59a1cfdf6e1286f0457798c52f3e2dd3c [file] [log] [blame]
Mikael Starvik51533b62005-07-27 11:44:44 -07001;; Core of the spinlock implementation
2;;
3;; Copyright (C) 2004 Axis Communications AB.
4;;
5;; Author: Mikael Starvik
6
7
8 .global cris_spin_lock
9 .global cris_spin_trylock
10
11 .text
12
13cris_spin_lock:
14 clearf p
Jesper Nilssonea0af952008-01-25 17:57:28 +0100151: test.b [$r10]
Mikael Starvik51533b62005-07-27 11:44:44 -070016 beq 1b
17 clearf p
18 ax
Jesper Nilssonea0af952008-01-25 17:57:28 +010019 clear.b [$r10]
Mikael Starvik51533b62005-07-27 11:44:44 -070020 bcs 1b
21 clearf p
22 ret
23 nop
24
25cris_spin_trylock:
26 clearf p
Jesper Nilssonea0af952008-01-25 17:57:28 +0100271: move.b [$r10], $r11
Mikael Starvik51533b62005-07-27 11:44:44 -070028 ax
Jesper Nilssonea0af952008-01-25 17:57:28 +010029 clear.b [$r10]
Mikael Starvik51533b62005-07-27 11:44:44 -070030 bcs 1b
31 clearf p
32 ret
Jesper Nilssonea0af952008-01-25 17:57:28 +010033 movu.b $r11,$r10