diff options
Diffstat (limited to 'arch/ppc/kernel')
-rw-r--r-- | arch/ppc/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/ppc/kernel/entry.S | 95 |
2 files changed, 24 insertions, 72 deletions
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index 7964bf660e92..77e4dc780f8c 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c | |||
@@ -131,7 +131,6 @@ main(void) | |||
131 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); | 131 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); |
132 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); | 132 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); |
133 | 133 | ||
134 | DEFINE(TI_SIGFRAME, offsetof(struct thread_info, nvgprs_frame)); | ||
135 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); | 134 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); |
136 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); | 135 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); |
137 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); | 136 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); |
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index a48b950722a1..3a2815978488 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -227,7 +227,7 @@ ret_from_syscall: | |||
227 | MTMSRD(r10) | 227 | MTMSRD(r10) |
228 | lwz r9,TI_FLAGS(r12) | 228 | lwz r9,TI_FLAGS(r12) |
229 | li r8,-_LAST_ERRNO | 229 | li r8,-_LAST_ERRNO |
230 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL) | 230 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) |
231 | bne- syscall_exit_work | 231 | bne- syscall_exit_work |
232 | cmplw 0,r3,r8 | 232 | cmplw 0,r3,r8 |
233 | blt+ syscall_exit_cont | 233 | blt+ syscall_exit_cont |
@@ -287,8 +287,10 @@ syscall_dotrace: | |||
287 | 287 | ||
288 | syscall_exit_work: | 288 | syscall_exit_work: |
289 | andi. r0,r9,_TIF_RESTOREALL | 289 | andi. r0,r9,_TIF_RESTOREALL |
290 | bne- 2f | 290 | beq+ 0f |
291 | cmplw 0,r3,r8 | 291 | REST_NVGPRS(r1) |
292 | b 2f | ||
293 | 0: cmplw 0,r3,r8 | ||
292 | blt+ 1f | 294 | blt+ 1f |
293 | andi. r0,r9,_TIF_NOERROR | 295 | andi. r0,r9,_TIF_NOERROR |
294 | bne- 1f | 296 | bne- 1f |
@@ -302,9 +304,7 @@ syscall_exit_work: | |||
302 | 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) | 304 | 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) |
303 | beq 4f | 305 | beq 4f |
304 | 306 | ||
305 | /* Clear per-syscall TIF flags if any are set, but _leave_ | 307 | /* Clear per-syscall TIF flags if any are set. */ |
306 | _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that | ||
307 | yet. */ | ||
308 | 308 | ||
309 | li r11,_TIF_PERSYSCALL_MASK | 309 | li r11,_TIF_PERSYSCALL_MASK |
310 | addi r12,r12,TI_FLAGS | 310 | addi r12,r12,TI_FLAGS |
@@ -318,8 +318,13 @@ syscall_exit_work: | |||
318 | subi r12,r12,TI_FLAGS | 318 | subi r12,r12,TI_FLAGS |
319 | 319 | ||
320 | 4: /* Anything which requires enabling interrupts? */ | 320 | 4: /* Anything which requires enabling interrupts? */ |
321 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS) | 321 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) |
322 | beq 7f | 322 | beq ret_from_except |
323 | |||
324 | /* Re-enable interrupts */ | ||
325 | ori r10,r10,MSR_EE | ||
326 | SYNC | ||
327 | MTMSRD(r10) | ||
323 | 328 | ||
324 | /* Save NVGPRS if they're not saved already */ | 329 | /* Save NVGPRS if they're not saved already */ |
325 | lwz r4,TRAP(r1) | 330 | lwz r4,TRAP(r1) |
@@ -328,71 +333,11 @@ syscall_exit_work: | |||
328 | SAVE_NVGPRS(r1) | 333 | SAVE_NVGPRS(r1) |
329 | li r4,0xc00 | 334 | li r4,0xc00 |
330 | stw r4,TRAP(r1) | 335 | stw r4,TRAP(r1) |
331 | 336 | 5: | |
332 | /* Re-enable interrupts */ | ||
333 | 5: ori r10,r10,MSR_EE | ||
334 | SYNC | ||
335 | MTMSRD(r10) | ||
336 | |||
337 | andi. r0,r9,_TIF_SAVE_NVGPRS | ||
338 | bne save_user_nvgprs | ||
339 | |||
340 | save_user_nvgprs_cont: | ||
341 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) | ||
342 | beq 7f | ||
343 | |||
344 | addi r3,r1,STACK_FRAME_OVERHEAD | 337 | addi r3,r1,STACK_FRAME_OVERHEAD |
345 | bl do_syscall_trace_leave | 338 | bl do_syscall_trace_leave |
346 | REST_NVGPRS(r1) | 339 | b ret_from_except_full |
347 | |||
348 | 6: lwz r3,GPR3(r1) | ||
349 | LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ | ||
350 | SYNC | ||
351 | MTMSRD(r10) /* disable interrupts again */ | ||
352 | rlwinm r12,r1,0,0,18 /* current_thread_info() */ | ||
353 | lwz r9,TI_FLAGS(r12) | ||
354 | 7: | ||
355 | andi. r0,r9,_TIF_NEED_RESCHED | ||
356 | bne 8f | ||
357 | lwz r5,_MSR(r1) | ||
358 | andi. r5,r5,MSR_PR | ||
359 | beq ret_from_except | ||
360 | andi. r0,r9,_TIF_SIGPENDING | ||
361 | beq ret_from_except | ||
362 | b do_user_signal | ||
363 | 8: | ||
364 | ori r10,r10,MSR_EE | ||
365 | SYNC | ||
366 | MTMSRD(r10) /* re-enable interrupts */ | ||
367 | bl schedule | ||
368 | b 6b | ||
369 | |||
370 | save_user_nvgprs: | ||
371 | lwz r8,TI_SIGFRAME(r12) | ||
372 | |||
373 | .macro savewords start, end | ||
374 | 1: stw \start,4*(\start)(r8) | ||
375 | .section __ex_table,"a" | ||
376 | .align 2 | ||
377 | .long 1b,save_user_nvgprs_fault | ||
378 | .previous | ||
379 | .if \end - \start | ||
380 | savewords "(\start+1)",\end | ||
381 | .endif | ||
382 | .endm | ||
383 | savewords 14,31 | ||
384 | b save_user_nvgprs_cont | ||
385 | |||
386 | |||
387 | save_user_nvgprs_fault: | ||
388 | li r3,11 /* SIGSEGV */ | ||
389 | lwz r4,TI_TASK(r12) | ||
390 | bl force_sigsegv | ||
391 | 340 | ||
392 | rlwinm r12,r1,0,0,18 /* current_thread_info() */ | ||
393 | lwz r9,TI_FLAGS(r12) | ||
394 | b save_user_nvgprs_cont | ||
395 | |||
396 | #ifdef SHOW_SYSCALLS | 341 | #ifdef SHOW_SYSCALLS |
397 | do_show_syscall: | 342 | do_show_syscall: |
398 | #ifdef SHOW_SYSCALLS_TASK | 343 | #ifdef SHOW_SYSCALLS_TASK |
@@ -490,6 +435,14 @@ ppc_clone: | |||
490 | stw r0,TRAP(r1) /* register set saved */ | 435 | stw r0,TRAP(r1) /* register set saved */ |
491 | b sys_clone | 436 | b sys_clone |
492 | 437 | ||
438 | .globl ppc_swapcontext | ||
439 | ppc_swapcontext: | ||
440 | SAVE_NVGPRS(r1) | ||
441 | lwz r0,TRAP(r1) | ||
442 | rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ | ||
443 | stw r0,TRAP(r1) /* register set saved */ | ||
444 | b sys_swapcontext | ||
445 | |||
493 | /* | 446 | /* |
494 | * Top-level page fault handling. | 447 | * Top-level page fault handling. |
495 | * This is in assembler because if do_page_fault tells us that | 448 | * This is in assembler because if do_page_fault tells us that |
@@ -683,7 +636,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ | |||
683 | /* Check current_thread_info()->flags */ | 636 | /* Check current_thread_info()->flags */ |
684 | rlwinm r9,r1,0,0,18 | 637 | rlwinm r9,r1,0,0,18 |
685 | lwz r9,TI_FLAGS(r9) | 638 | lwz r9,TI_FLAGS(r9) |
686 | andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL) | 639 | andi. r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED) |
687 | bne do_work | 640 | bne do_work |
688 | 641 | ||
689 | restore_user: | 642 | restore_user: |