Skip to content

Commit df06c27

Browse files
author
Al Viro
committed
sparc32: switch __bzero() away from range exception table entries
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 5f99d33 commit df06c27

File tree

1 file changed

+32
-40
lines changed

1 file changed

+32
-40
lines changed

arch/sparc/lib/memset.S

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,44 @@
2727
.text; \
2828
.align 4
2929

30-
#define EXT(start,end,handler) \
30+
#define STORE(source, base, offset, n) \
31+
98: std source, [base + offset + n]; \
32+
.section .fixup,ALLOC,EXECINSTR; \
33+
.align 4; \
34+
99: ba 30f; \
35+
sub %o3, n - offset, %o3; \
3136
.section __ex_table,ALLOC; \
3237
.align 4; \
33-
.word start, 0, end, handler; \
38+
.word 98b, 99b; \
3439
.text; \
35-
.align 4
40+
.align 4;
41+
42+
#define STORE_LAST(source, base, offset, n) \
43+
EX(std source, [base - offset - n], \
44+
add %o1, offset + n);
3645

3746
/* Please don't change these macros, unless you change the logic
3847
* in the .fixup section below as well.
3948
* Store 64 bytes at (BASE + OFFSET) using value SOURCE. */
40-
#define ZERO_BIG_BLOCK(base, offset, source) \
41-
std source, [base + offset + 0x00]; \
42-
std source, [base + offset + 0x08]; \
43-
std source, [base + offset + 0x10]; \
44-
std source, [base + offset + 0x18]; \
45-
std source, [base + offset + 0x20]; \
46-
std source, [base + offset + 0x28]; \
47-
std source, [base + offset + 0x30]; \
48-
std source, [base + offset + 0x38];
49+
#define ZERO_BIG_BLOCK(base, offset, source) \
50+
STORE(source, base, offset, 0x00); \
51+
STORE(source, base, offset, 0x08); \
52+
STORE(source, base, offset, 0x10); \
53+
STORE(source, base, offset, 0x18); \
54+
STORE(source, base, offset, 0x20); \
55+
STORE(source, base, offset, 0x28); \
56+
STORE(source, base, offset, 0x30); \
57+
STORE(source, base, offset, 0x38);
4958

5059
#define ZERO_LAST_BLOCKS(base, offset, source) \
51-
std source, [base - offset - 0x38]; \
52-
std source, [base - offset - 0x30]; \
53-
std source, [base - offset - 0x28]; \
54-
std source, [base - offset - 0x20]; \
55-
std source, [base - offset - 0x18]; \
56-
std source, [base - offset - 0x10]; \
57-
std source, [base - offset - 0x08]; \
58-
std source, [base - offset - 0x00];
60+
STORE_LAST(source, base, offset, 0x38); \
61+
STORE_LAST(source, base, offset, 0x30); \
62+
STORE_LAST(source, base, offset, 0x28); \
63+
STORE_LAST(source, base, offset, 0x20); \
64+
STORE_LAST(source, base, offset, 0x18); \
65+
STORE_LAST(source, base, offset, 0x10); \
66+
STORE_LAST(source, base, offset, 0x08); \
67+
STORE_LAST(source, base, offset, 0x00);
5968

6069
.text
6170
.align 4
@@ -120,8 +129,6 @@ __bzero:
120129
ZERO_BIG_BLOCK(%o0, 0x00, %g2)
121130
subcc %o3, 128, %o3
122131
ZERO_BIG_BLOCK(%o0, 0x40, %g2)
123-
11:
124-
EXT(10b, 11b, 20f)
125132
bne 10b
126133
add %o0, 128, %o0
127134

@@ -136,7 +143,6 @@ __bzero:
136143
jmp %o4
137144
add %o0, %o2, %o0
138145

139-
12:
140146
ZERO_LAST_BLOCKS(%o0, 0x48, %g2)
141147
ZERO_LAST_BLOCKS(%o0, 0x08, %g2)
142148
13:
@@ -182,24 +188,10 @@ __bzero:
182188

183189
.section .fixup,#alloc,#execinstr
184190
.align 4
185-
20:
186-
cmp %g2, 8
187-
bleu 1f
188-
and %o1, 0x7f, %o1
189-
sub %g2, 9, %g2
190-
add %o3, 64, %o3
191-
1:
192-
sll %g2, 3, %g2
193-
add %o3, %o1, %o0
194-
retl
195-
sub %o0, %g2, %o0
196-
21:
197-
mov 8, %o0
198-
and %o1, 7, %o1
199-
sub %o0, %g2, %o0
200-
sll %o0, 3, %o0
191+
30:
192+
and %o1, 0x7f, %o1
201193
retl
202-
add %o0, %o1, %o0
194+
add %o3, %o1, %o0
203195

204196
.globl __bzero_end
205197
__bzero_end:

0 commit comments

Comments
 (0)