blob: fe610b9d775f512a22ad4eb86f3e1724232b135f [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
Jesper Nilsson2d0503d2010-08-03 16:18:22 +02009 .type cris_spin_lock,@function
Mikael Starvik51533b62005-07-27 11:44:44 -070010 .global cris_spin_trylock
Jesper Nilsson2d0503d2010-08-03 16:18:22 +020011 .type cris_spin_trylock,@function
Mikael Starvik51533b62005-07-27 11:44:44 -070012
13 .text
14
15cris_spin_lock:
16 clearf p
Jesper Nilssonea0af952008-01-25 17:57:28 +0100171: test.b [$r10]
Mikael Starvik51533b62005-07-27 11:44:44 -070018 beq 1b
19 clearf p
20 ax
Jesper Nilssonea0af952008-01-25 17:57:28 +010021 clear.b [$r10]
Mikael Starvik51533b62005-07-27 11:44:44 -070022 bcs 1b
23 clearf p
24 ret
25 nop
26
Jesper Nilsson2d0503d2010-08-03 16:18:22 +020027 .size cris_spin_lock, . - cris_spin_lock
28
Mikael Starvik51533b62005-07-27 11:44:44 -070029cris_spin_trylock:
30 clearf p
Jesper Nilssonea0af952008-01-25 17:57:28 +0100311: move.b [$r10], $r11
Mikael Starvik51533b62005-07-27 11:44:44 -070032 ax
Jesper Nilssonea0af952008-01-25 17:57:28 +010033 clear.b [$r10]
Mikael Starvik51533b62005-07-27 11:44:44 -070034 bcs 1b
35 clearf p
36 ret
Jesper Nilssonea0af952008-01-25 17:57:28 +010037 movu.b $r11,$r10
Jesper Nilsson2d0503d2010-08-03 16:18:22 +020038
39 .size cris_spin_trylock, . - cris_spin_trylock
40