aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/entry_32.S
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2005-10-21 01:45:50 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-21 08:47:23 -0400
commit6cb7bfebb145af5ea1d052512a2ae7ff07a47202 (patch)
tree677ce52e6ad423f8a652ec3e16f98c3ad33fcc54 /arch/powerpc/kernel/entry_32.S
parentb0faa28493f97b55b36ff5b1a2b8c81bf253a460 (diff)
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty similar already, the chief changes are: - Instead of inline asm to implement current_thread_info(), which needs to be different for ppc32 and ppc64, we use C with an asm("r1") register variable. gcc turns it into the same asm as we used to have for both platforms. - We replace ppc32's 'local_flags' with the ppc64 'syscall_noerror' field. The noerror flag was in fact the only thing in the local_flags field anyway, so the ppc64 approach is simpler, and means we only need a load-immediate/store instead of load/mask/store when clearing the flag. - In readiness for 64k pages, when THREAD_SIZE will be less than a page, ppc64 used kmalloc() rather than get_free_pages() to allocate the kernel stack. With this patch we do the same for ppc32, since there's no strong reason not to. - For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE via asm-offsets, thread_info.h can now be safely included in asm, as on ppc32. Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and Power5 (ARCH=ppc64 and ARCH=powerpc). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_32.S')
-rw-r--r--arch/powerpc/kernel/entry_32.S25
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index fc9dded9ac04..37b4396ca978 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -199,10 +199,9 @@ _GLOBAL(DoSyscall)
199#ifdef SHOW_SYSCALLS 199#ifdef SHOW_SYSCALLS
200 bl do_show_syscall 200 bl do_show_syscall
201#endif /* SHOW_SYSCALLS */ 201#endif /* SHOW_SYSCALLS */
202 rlwinm r10,r1,0,0,18 /* current_thread_info() */ 202 rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
203 lwz r11,TI_LOCAL_FLAGS(r10) 203 li r11,0
204 rlwinm r11,r11,0,~_TIFL_FORCE_NOERROR 204 stb r11,TI_SC_NOERR(r10)
205 stw r11,TI_LOCAL_FLAGS(r10)
206 lwz r11,TI_FLAGS(r10) 205 lwz r11,TI_FLAGS(r10)
207 andi. r11,r11,_TIF_SYSCALL_T_OR_A 206 andi. r11,r11,_TIF_SYSCALL_T_OR_A
208 bne- syscall_dotrace 207 bne- syscall_dotrace
@@ -225,10 +224,10 @@ ret_from_syscall:
225 mr r6,r3 224 mr r6,r3
226 li r11,-_LAST_ERRNO 225 li r11,-_LAST_ERRNO
227 cmplw 0,r3,r11 226 cmplw 0,r3,r11
228 rlwinm r12,r1,0,0,18 /* current_thread_info() */ 227 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
229 blt+ 30f 228 blt+ 30f
230 lwz r11,TI_LOCAL_FLAGS(r12) 229 lbz r11,TI_SC_NOERR(r12)
231 andi. r11,r11,_TIFL_FORCE_NOERROR 230 cmpwi r11,0
232 bne 30f 231 bne 30f
233 neg r3,r3 232 neg r3,r3
234 lwz r10,_CCR(r1) /* Set SO bit in CR */ 233 lwz r10,_CCR(r1) /* Set SO bit in CR */
@@ -315,7 +314,7 @@ syscall_exit_work:
315 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ 314 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
316 SYNC 315 SYNC
317 MTMSRD(r10) /* disable interrupts again */ 316 MTMSRD(r10) /* disable interrupts again */
318 rlwinm r12,r1,0,0,18 /* current_thread_info() */ 317 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
319 lwz r9,TI_FLAGS(r12) 318 lwz r9,TI_FLAGS(r12)
3205: 3195:
321 andi. r0,r9,_TIF_NEED_RESCHED 320 andi. r0,r9,_TIF_NEED_RESCHED
@@ -630,7 +629,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
630 .globl sigreturn_exit 629 .globl sigreturn_exit
631sigreturn_exit: 630sigreturn_exit:
632 subi r1,r3,STACK_FRAME_OVERHEAD 631 subi r1,r3,STACK_FRAME_OVERHEAD
633 rlwinm r12,r1,0,0,18 /* current_thread_info() */ 632 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
634 lwz r9,TI_FLAGS(r12) 633 lwz r9,TI_FLAGS(r12)
635 andi. r0,r9,_TIF_SYSCALL_T_OR_A 634 andi. r0,r9,_TIF_SYSCALL_T_OR_A
636 beq+ ret_from_except_full 635 beq+ ret_from_except_full
@@ -657,7 +656,7 @@ ret_from_except:
657 656
658user_exc_return: /* r10 contains MSR_KERNEL here */ 657user_exc_return: /* r10 contains MSR_KERNEL here */
659 /* Check current_thread_info()->flags */ 658 /* Check current_thread_info()->flags */
660 rlwinm r9,r1,0,0,18 659 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
661 lwz r9,TI_FLAGS(r9) 660 lwz r9,TI_FLAGS(r9)
662 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED) 661 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
663 bne do_work 662 bne do_work
@@ -677,7 +676,7 @@ restore_user:
677/* N.B. the only way to get here is from the beq following ret_from_except. */ 676/* N.B. the only way to get here is from the beq following ret_from_except. */
678resume_kernel: 677resume_kernel:
679 /* check current_thread_info->preempt_count */ 678 /* check current_thread_info->preempt_count */
680 rlwinm r9,r1,0,0,18 679 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
681 lwz r0,TI_PREEMPT(r9) 680 lwz r0,TI_PREEMPT(r9)
682 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */ 681 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
683 bne restore 682 bne restore
@@ -687,7 +686,7 @@ resume_kernel:
687 andi. r0,r3,MSR_EE /* interrupts off? */ 686 andi. r0,r3,MSR_EE /* interrupts off? */
688 beq restore /* don't schedule if so */ 687 beq restore /* don't schedule if so */
6891: bl preempt_schedule_irq 6881: bl preempt_schedule_irq
690 rlwinm r9,r1,0,0,18 689 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
691 lwz r3,TI_FLAGS(r9) 690 lwz r3,TI_FLAGS(r9)
692 andi. r0,r3,_TIF_NEED_RESCHED 691 andi. r0,r3,_TIF_NEED_RESCHED
693 bne- 1b 692 bne- 1b
@@ -889,7 +888,7 @@ recheck:
889 LOAD_MSR_KERNEL(r10,MSR_KERNEL) 888 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
890 SYNC 889 SYNC
891 MTMSRD(r10) /* disable interrupts */ 890 MTMSRD(r10) /* disable interrupts */
892 rlwinm r9,r1,0,0,18 891 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
893 lwz r9,TI_FLAGS(r9) 892 lwz r9,TI_FLAGS(r9)
894 andi. r0,r9,_TIF_NEED_RESCHED 893 andi. r0,r9,_TIF_NEED_RESCHED
895 bne- do_resched 894 bne- do_resched