diff options
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 94 |
1 files changed, 21 insertions, 73 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 388f861b8ed1..24be0cf86d7f 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -160,7 +160,7 @@ syscall_exit: | |||
160 | mtmsrd r10,1 | 160 | mtmsrd r10,1 |
161 | ld r9,TI_FLAGS(r12) | 161 | ld r9,TI_FLAGS(r12) |
162 | li r11,-_LAST_ERRNO | 162 | li r11,-_LAST_ERRNO |
163 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_SAVE_NVGPRS|_TIF_NOERROR|_TIF_RESTORE_SIGMASK) | 163 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) |
164 | bne- syscall_exit_work | 164 | bne- syscall_exit_work |
165 | cmpld r3,r11 | 165 | cmpld r3,r11 |
166 | ld r5,_CCR(r1) | 166 | ld r5,_CCR(r1) |
@@ -216,8 +216,10 @@ syscall_exit_work: | |||
216 | If TIF_NOERROR is set, just save r3 as it is. */ | 216 | If TIF_NOERROR is set, just save r3 as it is. */ |
217 | 217 | ||
218 | andi. r0,r9,_TIF_RESTOREALL | 218 | andi. r0,r9,_TIF_RESTOREALL |
219 | bne- 2f | 219 | beq+ 0f |
220 | cmpld r3,r11 /* r10 is -LAST_ERRNO */ | 220 | REST_NVGPRS(r1) |
221 | b 2f | ||
222 | 0: cmpld r3,r11 /* r10 is -LAST_ERRNO */ | ||
221 | blt+ 1f | 223 | blt+ 1f |
222 | andi. r0,r9,_TIF_NOERROR | 224 | andi. r0,r9,_TIF_NOERROR |
223 | bne- 1f | 225 | bne- 1f |
@@ -229,9 +231,7 @@ syscall_exit_work: | |||
229 | 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) | 231 | 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) |
230 | beq 4f | 232 | beq 4f |
231 | 233 | ||
232 | /* Clear per-syscall TIF flags if any are set, but _leave_ | 234 | /* Clear per-syscall TIF flags if any are set. */ |
233 | _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that | ||
234 | yet. */ | ||
235 | 235 | ||
236 | li r11,_TIF_PERSYSCALL_MASK | 236 | li r11,_TIF_PERSYSCALL_MASK |
237 | addi r12,r12,TI_FLAGS | 237 | addi r12,r12,TI_FLAGS |
@@ -240,10 +240,9 @@ syscall_exit_work: | |||
240 | stdcx. r10,0,r12 | 240 | stdcx. r10,0,r12 |
241 | bne- 3b | 241 | bne- 3b |
242 | subi r12,r12,TI_FLAGS | 242 | subi r12,r12,TI_FLAGS |
243 | 243 | ||
244 | 4: bl .save_nvgprs | 244 | 4: /* Anything else left to do? */ |
245 | /* Anything else left to do? */ | 245 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) |
246 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS) | ||
247 | beq .ret_from_except_lite | 246 | beq .ret_from_except_lite |
248 | 247 | ||
249 | /* Re-enable interrupts */ | 248 | /* Re-enable interrupts */ |
@@ -251,26 +250,10 @@ syscall_exit_work: | |||
251 | ori r10,r10,MSR_EE | 250 | ori r10,r10,MSR_EE |
252 | mtmsrd r10,1 | 251 | mtmsrd r10,1 |
253 | 252 | ||
254 | andi. r0,r9,_TIF_SAVE_NVGPRS | 253 | bl .save_nvgprs |
255 | bne save_user_nvgprs | ||
256 | |||
257 | /* If tracing, re-enable interrupts and do it */ | ||
258 | save_user_nvgprs_cont: | ||
259 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) | ||
260 | beq 5f | ||
261 | |||
262 | addi r3,r1,STACK_FRAME_OVERHEAD | 254 | addi r3,r1,STACK_FRAME_OVERHEAD |
263 | bl .do_syscall_trace_leave | 255 | bl .do_syscall_trace_leave |
264 | REST_NVGPRS(r1) | 256 | b .ret_from_except |
265 | clrrdi r12,r1,THREAD_SHIFT | ||
266 | |||
267 | /* Disable interrupts again and handle other work if any */ | ||
268 | 5: mfmsr r10 | ||
269 | rldicl r10,r10,48,1 | ||
270 | rotldi r10,r10,16 | ||
271 | mtmsrd r10,1 | ||
272 | |||
273 | b .ret_from_except_lite | ||
274 | 257 | ||
275 | /* Save non-volatile GPRs, if not already saved. */ | 258 | /* Save non-volatile GPRs, if not already saved. */ |
276 | _GLOBAL(save_nvgprs) | 259 | _GLOBAL(save_nvgprs) |
@@ -282,51 +265,6 @@ _GLOBAL(save_nvgprs) | |||
282 | std r0,_TRAP(r1) | 265 | std r0,_TRAP(r1) |
283 | blr | 266 | blr |
284 | 267 | ||
285 | |||
286 | save_user_nvgprs: | ||
287 | ld r10,TI_SIGFRAME(r12) | ||
288 | andi. r0,r9,_TIF_32BIT | ||
289 | beq- save_user_nvgprs_64 | ||
290 | |||
291 | /* 32-bit save to userspace */ | ||
292 | |||
293 | .macro savewords start, end | ||
294 | 1: stw \start,4*(\start)(r10) | ||
295 | .section __ex_table,"a" | ||
296 | .align 3 | ||
297 | .llong 1b,save_user_nvgprs_fault | ||
298 | .previous | ||
299 | .if \end - \start | ||
300 | savewords "(\start+1)",\end | ||
301 | .endif | ||
302 | .endm | ||
303 | savewords 14,31 | ||
304 | b save_user_nvgprs_cont | ||
305 | |||
306 | save_user_nvgprs_64: | ||
307 | /* 64-bit save to userspace */ | ||
308 | |||
309 | .macro savelongs start, end | ||
310 | 1: std \start,8*(\start)(r10) | ||
311 | .section __ex_table,"a" | ||
312 | .align 3 | ||
313 | .llong 1b,save_user_nvgprs_fault | ||
314 | .previous | ||
315 | .if \end - \start | ||
316 | savelongs "(\start+1)",\end | ||
317 | .endif | ||
318 | .endm | ||
319 | savelongs 14,31 | ||
320 | b save_user_nvgprs_cont | ||
321 | |||
322 | save_user_nvgprs_fault: | ||
323 | li r3,11 /* SIGSEGV */ | ||
324 | ld r4,TI_TASK(r12) | ||
325 | bl .force_sigsegv | ||
326 | |||
327 | clrrdi r12,r1,THREAD_SHIFT | ||
328 | ld r9,TI_FLAGS(r12) | ||
329 | b save_user_nvgprs_cont | ||
330 | 268 | ||
331 | /* | 269 | /* |
332 | * The sigsuspend and rt_sigsuspend system calls can call do_signal | 270 | * The sigsuspend and rt_sigsuspend system calls can call do_signal |
@@ -352,6 +290,16 @@ _GLOBAL(ppc_clone) | |||
352 | bl .sys_clone | 290 | bl .sys_clone |
353 | b syscall_exit | 291 | b syscall_exit |
354 | 292 | ||
293 | _GLOBAL(ppc32_swapcontext) | ||
294 | bl .save_nvgprs | ||
295 | bl .compat_sys_swapcontext | ||
296 | b syscall_exit | ||
297 | |||
298 | _GLOBAL(ppc64_swapcontext) | ||
299 | bl .save_nvgprs | ||
300 | bl .sys_swapcontext | ||
301 | b syscall_exit | ||
302 | |||
355 | _GLOBAL(ret_from_fork) | 303 | _GLOBAL(ret_from_fork) |
356 | bl .schedule_tail | 304 | bl .schedule_tail |
357 | REST_NVGPRS(r1) | 305 | REST_NVGPRS(r1) |