aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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
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')
-rw-r--r--arch/powerpc/kernel/asm-offsets.c6
-rw-r--r--arch/powerpc/kernel/entry_32.S25
-rw-r--r--arch/powerpc/kernel/head_64.S1
-rw-r--r--arch/powerpc/kernel/misc_64.S1
-rw-r--r--arch/ppc/kernel/asm-offsets.c2
-rw-r--r--arch/ppc/kernel/entry.S9
-rw-r--r--arch/ppc64/kernel/asm-offsets.c2
-rw-r--r--arch/ppc64/kernel/head.S1
-rw-r--r--arch/ppc64/kernel/misc.S1
9 files changed, 22 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index b0d6a7cd85e9..1c83abd9f37c 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -56,8 +56,6 @@ int main(void)
56 DEFINE(THREAD, offsetof(struct task_struct, thread)); 56 DEFINE(THREAD, offsetof(struct task_struct, thread));
57 DEFINE(MM, offsetof(struct task_struct, mm)); 57 DEFINE(MM, offsetof(struct task_struct, mm));
58#ifdef CONFIG_PPC64 58#ifdef CONFIG_PPC64
59 DEFINE(THREAD_SHIFT, THREAD_SHIFT);
60 DEFINE(THREAD_SIZE, THREAD_SIZE);
61 DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context)); 59 DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context));
62#else 60#else
63 DEFINE(THREAD_INFO, offsetof(struct task_struct, thread_info)); 61 DEFINE(THREAD_INFO, offsetof(struct task_struct, thread_info));
@@ -94,12 +92,10 @@ int main(void)
94 92
95 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
96 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); 94 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
97#ifdef CONFIG_PPC64
98 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror)); 95 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror));
99#else 96#ifdef CONFIG_PPC32
100 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 97 DEFINE(TI_TASK, offsetof(struct thread_info, task));
101 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); 98 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
102 DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
103 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 99 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
104#endif /* CONFIG_PPC64 */ 100#endif /* CONFIG_PPC64 */
105 101
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
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index a4ceb9ae20fc..72b0d26e41d4 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -36,6 +36,7 @@
36#include <asm/setup.h> 36#include <asm/setup.h>
37#include <asm/hvcall.h> 37#include <asm/hvcall.h>
38#include <asm/iSeries/LparMap.h> 38#include <asm/iSeries/LparMap.h>
39#include <asm/thread_info.h>
39 40
40#ifdef CONFIG_PPC_ISERIES 41#ifdef CONFIG_PPC_ISERIES
41#define DO_SOFT_DISABLE 42#define DO_SOFT_DISABLE
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 8fe295693c09..4775bed42cac 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -26,6 +26,7 @@
26#include <asm/ppc_asm.h> 26#include <asm/ppc_asm.h>
27#include <asm/asm-offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/cputable.h> 28#include <asm/cputable.h>
29#include <asm/thread_info.h>
29 30
30 .text 31 .text
31 32
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c
index 7972db1f6570..968261d69572 100644
--- a/arch/ppc/kernel/asm-offsets.c
+++ b/arch/ppc/kernel/asm-offsets.c
@@ -130,10 +130,10 @@ main(void)
130 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); 130 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
131 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); 131 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
132 132
133 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror));
133 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 134 DEFINE(TI_TASK, offsetof(struct thread_info, task));
134 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); 135 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
135 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 136 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
136 DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
137 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 137 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
138 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); 138 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
139 139
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index 68fc61221776..f044edbb454f 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -200,9 +200,8 @@ _GLOBAL(DoSyscall)
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,18 /* 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
@@ -227,8 +226,8 @@ ret_from_syscall:
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,18 /* 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 */
diff --git a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c
index 1378fbbe1e57..5e6046cb414e 100644
--- a/arch/ppc64/kernel/asm-offsets.c
+++ b/arch/ppc64/kernel/asm-offsets.c
@@ -46,8 +46,6 @@
46int main(void) 46int main(void)
47{ 47{
48 /* thread struct on stack */ 48 /* thread struct on stack */
49 DEFINE(THREAD_SHIFT, THREAD_SHIFT);
50 DEFINE(THREAD_SIZE, THREAD_SIZE);
51 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 49 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
52 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); 50 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
53 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror)); 51 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror));
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index d5e6be200764..15c5f0c48043 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -36,6 +36,7 @@
36#include <asm/setup.h> 36#include <asm/setup.h>
37#include <asm/hvcall.h> 37#include <asm/hvcall.h>
38#include <asm/iSeries/LparMap.h> 38#include <asm/iSeries/LparMap.h>
39#include <asm/thread_info.h>
39 40
40#ifdef CONFIG_PPC_ISERIES 41#ifdef CONFIG_PPC_ISERIES
41#define DO_SOFT_DISABLE 42#define DO_SOFT_DISABLE
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index ad73aad8dbb6..a33448c2bd91 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -28,6 +28,7 @@
28#include <asm/ppc_asm.h> 28#include <asm/ppc_asm.h>
29#include <asm/asm-offsets.h> 29#include <asm/asm-offsets.h>
30#include <asm/cputable.h> 30#include <asm/cputable.h>
31#include <asm/thread_info.h>
31 32
32 .text 33 .text
33 34