diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2008-12-03 06:10:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-04 12:17:19 -0500 |
commit | 478b8fecda511942404ac232897a718cecd13e48 (patch) | |
tree | e022fce8ca92f93a000e1cd686255f0b126e9fd5 /arch/sparc/lib/bitops.S | |
parent | 18269c0fd4db9bec2668f895f21d742486ccb90f (diff) |
sparc,sparc64: unify lib/
o Renamed files in sparc64 to <name>_64.S when identical
to sparc32 files.
o iomap.c were equal for sparc32 and sparc64
o adjusted sparc/Makefile now we have only one lib/
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/lib/bitops.S')
-rw-r--r-- | arch/sparc/lib/bitops.S | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/arch/sparc/lib/bitops.S b/arch/sparc/lib/bitops.S new file mode 100644 index 00000000000..2b7228cb8c2 --- /dev/null +++ b/arch/sparc/lib/bitops.S | |||
@@ -0,0 +1,141 @@ | |||
1 | /* bitops.S: Sparc64 atomic bit operations. | ||
2 | * | ||
3 | * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net) | ||
4 | */ | ||
5 | |||
6 | #include <asm/asi.h> | ||
7 | #include <asm/backoff.h> | ||
8 | |||
9 | .text | ||
10 | |||
11 | .globl test_and_set_bit | ||
12 | .type test_and_set_bit,#function | ||
13 | test_and_set_bit: /* %o0=nr, %o1=addr */ | ||
14 | BACKOFF_SETUP(%o3) | ||
15 | srlx %o0, 6, %g1 | ||
16 | mov 1, %o2 | ||
17 | sllx %g1, 3, %g3 | ||
18 | and %o0, 63, %g2 | ||
19 | sllx %o2, %g2, %o2 | ||
20 | add %o1, %g3, %o1 | ||
21 | 1: ldx [%o1], %g7 | ||
22 | or %g7, %o2, %g1 | ||
23 | casx [%o1], %g7, %g1 | ||
24 | cmp %g7, %g1 | ||
25 | bne,pn %xcc, 2f | ||
26 | and %g7, %o2, %g2 | ||
27 | clr %o0 | ||
28 | movrne %g2, 1, %o0 | ||
29 | retl | ||
30 | nop | ||
31 | 2: BACKOFF_SPIN(%o3, %o4, 1b) | ||
32 | .size test_and_set_bit, .-test_and_set_bit | ||
33 | |||
34 | .globl test_and_clear_bit | ||
35 | .type test_and_clear_bit,#function | ||
36 | test_and_clear_bit: /* %o0=nr, %o1=addr */ | ||
37 | BACKOFF_SETUP(%o3) | ||
38 | srlx %o0, 6, %g1 | ||
39 | mov 1, %o2 | ||
40 | sllx %g1, 3, %g3 | ||
41 | and %o0, 63, %g2 | ||
42 | sllx %o2, %g2, %o2 | ||
43 | add %o1, %g3, %o1 | ||
44 | 1: ldx [%o1], %g7 | ||
45 | andn %g7, %o2, %g1 | ||
46 | casx [%o1], %g7, %g1 | ||
47 | cmp %g7, %g1 | ||
48 | bne,pn %xcc, 2f | ||
49 | and %g7, %o2, %g2 | ||
50 | clr %o0 | ||
51 | movrne %g2, 1, %o0 | ||
52 | retl | ||
53 | nop | ||
54 | 2: BACKOFF_SPIN(%o3, %o4, 1b) | ||
55 | .size test_and_clear_bit, .-test_and_clear_bit | ||
56 | |||
57 | .globl test_and_change_bit | ||
58 | .type test_and_change_bit,#function | ||
59 | test_and_change_bit: /* %o0=nr, %o1=addr */ | ||
60 | BACKOFF_SETUP(%o3) | ||
61 | srlx %o0, 6, %g1 | ||
62 | mov 1, %o2 | ||
63 | sllx %g1, 3, %g3 | ||
64 | and %o0, 63, %g2 | ||
65 | sllx %o2, %g2, %o2 | ||
66 | add %o1, %g3, %o1 | ||
67 | 1: ldx [%o1], %g7 | ||
68 | xor %g7, %o2, %g1 | ||
69 | casx [%o1], %g7, %g1 | ||
70 | cmp %g7, %g1 | ||
71 | bne,pn %xcc, 2f | ||
72 | and %g7, %o2, %g2 | ||
73 | clr %o0 | ||
74 | movrne %g2, 1, %o0 | ||
75 | retl | ||
76 | nop | ||
77 | 2: BACKOFF_SPIN(%o3, %o4, 1b) | ||
78 | .size test_and_change_bit, .-test_and_change_bit | ||
79 | |||
80 | .globl set_bit | ||
81 | .type set_bit,#function | ||
82 | set_bit: /* %o0=nr, %o1=addr */ | ||
83 | BACKOFF_SETUP(%o3) | ||
84 | srlx %o0, 6, %g1 | ||
85 | mov 1, %o2 | ||
86 | sllx %g1, 3, %g3 | ||
87 | and %o0, 63, %g2 | ||
88 | sllx %o2, %g2, %o2 | ||
89 | add %o1, %g3, %o1 | ||
90 | 1: ldx [%o1], %g7 | ||
91 | or %g7, %o2, %g1 | ||
92 | casx [%o1], %g7, %g1 | ||
93 | cmp %g7, %g1 | ||
94 | bne,pn %xcc, 2f | ||
95 | nop | ||
96 | retl | ||
97 | nop | ||
98 | 2: BACKOFF_SPIN(%o3, %o4, 1b) | ||
99 | .size set_bit, .-set_bit | ||
100 | |||
101 | .globl clear_bit | ||
102 | .type clear_bit,#function | ||
103 | clear_bit: /* %o0=nr, %o1=addr */ | ||
104 | BACKOFF_SETUP(%o3) | ||
105 | srlx %o0, 6, %g1 | ||
106 | mov 1, %o2 | ||
107 | sllx %g1, 3, %g3 | ||
108 | and %o0, 63, %g2 | ||
109 | sllx %o2, %g2, %o2 | ||
110 | add %o1, %g3, %o1 | ||
111 | 1: ldx [%o1], %g7 | ||
112 | andn %g7, %o2, %g1 | ||
113 | casx [%o1], %g7, %g1 | ||
114 | cmp %g7, %g1 | ||
115 | bne,pn %xcc, 2f | ||
116 | nop | ||
117 | retl | ||
118 | nop | ||
119 | 2: BACKOFF_SPIN(%o3, %o4, 1b) | ||
120 | .size clear_bit, .-clear_bit | ||
121 | |||
122 | .globl change_bit | ||
123 | .type change_bit,#function | ||
124 | change_bit: /* %o0=nr, %o1=addr */ | ||
125 | BACKOFF_SETUP(%o3) | ||
126 | srlx %o0, 6, %g1 | ||
127 | mov 1, %o2 | ||
128 | sllx %g1, 3, %g3 | ||
129 | and %o0, 63, %g2 | ||
130 | sllx %o2, %g2, %o2 | ||
131 | add %o1, %g3, %o1 | ||
132 | 1: ldx [%o1], %g7 | ||
133 | xor %g7, %o2, %g1 | ||
134 | casx [%o1], %g7, %g1 | ||
135 | cmp %g7, %g1 | ||
136 | bne,pn %xcc, 2f | ||
137 | nop | ||
138 | retl | ||
139 | nop | ||
140 | 2: BACKOFF_SPIN(%o3, %o4, 1b) | ||
141 | .size change_bit, .-change_bit | ||