1 /* $Id: locks.S,v 1.15 1998/10/14 09:18:55 jj Exp $
2 * locks.S: SMP low-level lock primitives on Sparc.
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1998 Anton Blanchard (anton@progsoc.uts.edu.au)
6 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
9 #include <asm/cprefix.h>
10 #include <asm/ptrace.h>
13 #include <asm/spinlock.h>
18 /* This is called when the initial acquisition attempt of a spin
19 * lock fails. The calling convention is weird, return address
20 * is in %o7 as usual but we agree with the caller to only touch
21 * and use %g2 as a temporary. We are passed a ptr to the lock
22 * itself in %g1, %g4 must be restored into %o7 when we return,
23 * and the caller wants us to return to him at three instructions
24 * previous to the call instruction which got us here. See how
25 * this is used in asm/spinlock.h if what I just said confuses
28 .globl ___spinlock_waitfor
37 /* Read/writer locks, as usual this is overly clever to make it
38 * as fast as possible.
42 ___rw_read_enter_spin_on_wlock:
46 b ___rw_read_enter_spin_on_wlock
48 ___rw_read_exit_spin_on_wlock:
52 b ___rw_read_exit_spin_on_wlock
54 ___rw_write_enter_spin_on_wlock:
56 be,a ___rw_write_enter
58 b ___rw_write_enter_spin_on_wlock
61 .globl ___rw_read_enter
64 bne,a ___rw_read_enter_spin_on_wlock
72 .globl ___rw_read_exit
75 bne,a ___rw_read_exit_spin_on_wlock
83 .globl ___rw_write_enter
86 bne ___rw_write_enter_spin_on_wlock
89 bne,a ___rw_write_enter_spin_on_wlock