diff options
author | Michal Simek <monstr@monstr.eu> | 2012-03-30 02:21:38 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2012-03-30 05:37:13 -0400 |
commit | ac64a9caa55bdfd8d24784f25c68cb7919ddabe3 (patch) | |
tree | 9832daebc0a5c4e97388ff37aae74bf32cbfabfd /arch | |
parent | a28d73ca3ac7fffff317e62167ef26310b951ca0 (diff) |
microblaze: Fix stack usage in PAGE_SIZE copy_tofrom_user
If access to user space failed we need to reconstruct
stack pointer and restore all register.
This patch fixed problem introduces by:
"microblaze: Add loop unrolling for PAGE in copy_tofrom_user"
(sha1: ebe211254bfa6295f4ab0b33c7c881bdfabbab60)
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/microblaze/lib/uaccess_old.S | 98 |
1 files changed, 62 insertions, 36 deletions
diff --git a/arch/microblaze/lib/uaccess_old.S b/arch/microblaze/lib/uaccess_old.S index f037266cdaf3..f085995ee848 100644 --- a/arch/microblaze/lib/uaccess_old.S +++ b/arch/microblaze/lib/uaccess_old.S | |||
@@ -122,22 +122,22 @@ __strnlen_user: | |||
122 | 15: swi r24, r5, 0x0018 + offset; \ | 122 | 15: swi r24, r5, 0x0018 + offset; \ |
123 | 16: swi r25, r5, 0x001C + offset; \ | 123 | 16: swi r25, r5, 0x001C + offset; \ |
124 | .section __ex_table,"a"; \ | 124 | .section __ex_table,"a"; \ |
125 | .word 1b, 0f; \ | 125 | .word 1b, 33f; \ |
126 | .word 2b, 0f; \ | 126 | .word 2b, 33f; \ |
127 | .word 3b, 0f; \ | 127 | .word 3b, 33f; \ |
128 | .word 4b, 0f; \ | 128 | .word 4b, 33f; \ |
129 | .word 5b, 0f; \ | 129 | .word 5b, 33f; \ |
130 | .word 6b, 0f; \ | 130 | .word 6b, 33f; \ |
131 | .word 7b, 0f; \ | 131 | .word 7b, 33f; \ |
132 | .word 8b, 0f; \ | 132 | .word 8b, 33f; \ |
133 | .word 9b, 0f; \ | 133 | .word 9b, 33f; \ |
134 | .word 10b, 0f; \ | 134 | .word 10b, 33f; \ |
135 | .word 11b, 0f; \ | 135 | .word 11b, 33f; \ |
136 | .word 12b, 0f; \ | 136 | .word 12b, 33f; \ |
137 | .word 13b, 0f; \ | 137 | .word 13b, 33f; \ |
138 | .word 14b, 0f; \ | 138 | .word 14b, 33f; \ |
139 | .word 15b, 0f; \ | 139 | .word 15b, 33f; \ |
140 | .word 16b, 0f; \ | 140 | .word 16b, 33f; \ |
141 | .text | 141 | .text |
142 | 142 | ||
143 | #define COPY_80(offset) \ | 143 | #define COPY_80(offset) \ |
@@ -190,14 +190,17 @@ w2: sw r4, r5, r3 | |||
190 | 190 | ||
191 | .align 4 /* Alignment is important to keep icache happy */ | 191 | .align 4 /* Alignment is important to keep icache happy */ |
192 | page: /* Create room on stack and save registers for storign values */ | 192 | page: /* Create room on stack and save registers for storign values */ |
193 | addik r1, r1, -32 | 193 | addik r1, r1, -40 |
194 | swi r19, r1, 4 | 194 | swi r5, r1, 0 |
195 | swi r20, r1, 8 | 195 | swi r6, r1, 4 |
196 | swi r21, r1, 12 | 196 | swi r7, r1, 8 |
197 | swi r22, r1, 16 | 197 | swi r19, r1, 12 |
198 | swi r23, r1, 20 | 198 | swi r20, r1, 16 |
199 | swi r24, r1, 24 | 199 | swi r21, r1, 20 |
200 | swi r25, r1, 28 | 200 | swi r22, r1, 24 |
201 | swi r23, r1, 28 | ||
202 | swi r24, r1, 32 | ||
203 | swi r25, r1, 36 | ||
201 | loop: /* r4, r19, r20, r21, r22, r23, r24, r25 are used for storing values */ | 204 | loop: /* r4, r19, r20, r21, r22, r23, r24, r25 are used for storing values */ |
202 | /* Loop unrolling to get performance boost */ | 205 | /* Loop unrolling to get performance boost */ |
203 | COPY_80(0x000); | 206 | COPY_80(0x000); |
@@ -205,21 +208,44 @@ loop: /* r4, r19, r20, r21, r22, r23, r24, r25 are used for storing values */ | |||
205 | COPY_80(0x100); | 208 | COPY_80(0x100); |
206 | COPY_80(0x180); | 209 | COPY_80(0x180); |
207 | /* copy loop */ | 210 | /* copy loop */ |
208 | addik r6, r6, 0x200 | 211 | addik r6, r6, 0x200 |
209 | addik r7, r7, -0x200 | 212 | addik r7, r7, -0x200 |
210 | bneid r7, loop | 213 | bneid r7, loop |
211 | addik r5, r5, 0x200 | 214 | addik r5, r5, 0x200 |
215 | |||
212 | /* Restore register content */ | 216 | /* Restore register content */ |
213 | lwi r19, r1, 4 | 217 | lwi r5, r1, 0 |
214 | lwi r20, r1, 8 | 218 | lwi r6, r1, 4 |
215 | lwi r21, r1, 12 | 219 | lwi r7, r1, 8 |
216 | lwi r22, r1, 16 | 220 | lwi r19, r1, 12 |
217 | lwi r23, r1, 20 | 221 | lwi r20, r1, 16 |
218 | lwi r24, r1, 24 | 222 | lwi r21, r1, 20 |
219 | lwi r25, r1, 28 | 223 | lwi r22, r1, 24 |
220 | addik r1, r1, 32 | 224 | lwi r23, r1, 28 |
225 | lwi r24, r1, 32 | ||
226 | lwi r25, r1, 36 | ||
227 | addik r1, r1, 40 | ||
221 | /* return back */ | 228 | /* return back */ |
229 | addik r3, r0, 0 | ||
230 | rtsd r15, 8 | ||
231 | nop | ||
232 | |||
233 | /* Fault case - return temp count */ | ||
234 | 33: | ||
222 | addik r3, r7, 0 | 235 | addik r3, r7, 0 |
236 | /* Restore register content */ | ||
237 | lwi r5, r1, 0 | ||
238 | lwi r6, r1, 4 | ||
239 | lwi r7, r1, 8 | ||
240 | lwi r19, r1, 12 | ||
241 | lwi r20, r1, 16 | ||
242 | lwi r21, r1, 20 | ||
243 | lwi r22, r1, 24 | ||
244 | lwi r23, r1, 28 | ||
245 | lwi r24, r1, 32 | ||
246 | lwi r25, r1, 36 | ||
247 | addik r1, r1, 40 | ||
248 | /* return back */ | ||
223 | rtsd r15, 8 | 249 | rtsd r15, 8 |
224 | nop | 250 | nop |
225 | 251 | ||