aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/lib/locks.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sparc/lib/locks.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sparc/lib/locks.S')
-rw-r--r--arch/sparc/lib/locks.S72
1 files changed, 72 insertions, 0 deletions
diff --git a/arch/sparc/lib/locks.S b/arch/sparc/lib/locks.S
new file mode 100644
index 000000000000..95fa48424967
--- /dev/null
+++ b/arch/sparc/lib/locks.S
@@ -0,0 +1,72 @@
1/* $Id: locks.S,v 1.16 2000/02/26 11:02:47 anton Exp $
2 * locks.S: SMP low-level lock primitives on Sparc.
3 *
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)
7 */
8
9#include <asm/ptrace.h>
10#include <asm/psr.h>
11#include <asm/smp.h>
12#include <asm/spinlock.h>
13
14 .text
15 .align 4
16
17 /* Read/writer locks, as usual this is overly clever to make it
18 * as fast as possible.
19 */
20
21 /* caches... */
22___rw_read_enter_spin_on_wlock:
23 orcc %g2, 0x0, %g0
24 be,a ___rw_read_enter
25 ldstub [%g1 + 3], %g2
26 b ___rw_read_enter_spin_on_wlock
27 ldub [%g1 + 3], %g2
28___rw_read_exit_spin_on_wlock:
29 orcc %g2, 0x0, %g0
30 be,a ___rw_read_exit
31 ldstub [%g1 + 3], %g2
32 b ___rw_read_exit_spin_on_wlock
33 ldub [%g1 + 3], %g2
34___rw_write_enter_spin_on_wlock:
35 orcc %g2, 0x0, %g0
36 be,a ___rw_write_enter
37 ldstub [%g1 + 3], %g2
38 b ___rw_write_enter_spin_on_wlock
39 ld [%g1], %g2
40
41 .globl ___rw_read_enter
42___rw_read_enter:
43 orcc %g2, 0x0, %g0
44 bne,a ___rw_read_enter_spin_on_wlock
45 ldub [%g1 + 3], %g2
46 ld [%g1], %g2
47 add %g2, 1, %g2
48 st %g2, [%g1]
49 retl
50 mov %g4, %o7
51
52 .globl ___rw_read_exit
53___rw_read_exit:
54 orcc %g2, 0x0, %g0
55 bne,a ___rw_read_exit_spin_on_wlock
56 ldub [%g1 + 3], %g2
57 ld [%g1], %g2
58 sub %g2, 0x1ff, %g2
59 st %g2, [%g1]
60 retl
61 mov %g4, %o7
62
63 .globl ___rw_write_enter
64___rw_write_enter:
65 orcc %g2, 0x0, %g0
66 bne ___rw_write_enter_spin_on_wlock
67 ld [%g1], %g2
68 andncc %g2, 0xff, %g0
69 bne,a ___rw_write_enter_spin_on_wlock
70 stb %g0, [%g1 + 3]
71 retl
72 mov %g4, %o7