aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--include/asm-powerpc/thread_info.h (renamed from include/asm-ppc64/thread_info.h)34
-rw-r--r--include/asm-ppc/ptrace.h2
-rw-r--r--include/asm-ppc/thread_info.h107
12 files changed, 45 insertions, 146 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
diff --git a/include/asm-ppc64/thread_info.h b/include/asm-powerpc/thread_info.h
index 71244d8a427d..0b4c24551c21 100644
--- a/include/asm-ppc64/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -1,15 +1,25 @@
1/* thread_info.h: PPC low-level thread information 1/* thread_info.h: PowerPC low-level thread information
2 * adapted from the i386 version by Paul Mackerras 2 * adapted from the i386 version by Paul Mackerras
3 * 3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com) 4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller 5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */ 6 */
7 7
8#ifndef _ASM_THREAD_INFO_H 8#ifndef _ASM_POWERPC_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H 9#define _ASM_POWERPC_THREAD_INFO_H
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13/* We have 8k stacks on ppc32 and 16k on ppc64 */
14
15#ifdef CONFIG_PPC64
16#define THREAD_SHIFT 14
17#else
18#define THREAD_SHIFT 13
19#endif
20
21#define THREAD_SIZE (1 << THREAD_SHIFT)
22
13#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
14#include <linux/config.h> 24#include <linux/config.h>
15#include <linux/cache.h> 25#include <linux/cache.h>
@@ -24,7 +34,8 @@ struct thread_info {
24 struct task_struct *task; /* main task structure */ 34 struct task_struct *task; /* main task structure */
25 struct exec_domain *exec_domain; /* execution domain */ 35 struct exec_domain *exec_domain; /* execution domain */
26 int cpu; /* cpu we're on */ 36 int cpu; /* cpu we're on */
27 int preempt_count; /* 0 => preemptable, <0 => BUG */ 37 int preempt_count; /* 0 => preemptable,
38 <0 => BUG */
28 struct restart_block restart_block; 39 struct restart_block restart_block;
29 /* set by force_successful_syscall_return */ 40 /* set by force_successful_syscall_return */
30 unsigned char syscall_noerror; 41 unsigned char syscall_noerror;
@@ -54,9 +65,6 @@ struct thread_info {
54 65
55/* thread information allocation */ 66/* thread information allocation */
56 67
57#define THREAD_SHIFT 14
58#define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT)
59#define THREAD_SIZE (1 << THREAD_SHIFT)
60#ifdef CONFIG_DEBUG_STACK_USAGE 68#ifdef CONFIG_DEBUG_STACK_USAGE
61#define alloc_thread_info(tsk) \ 69#define alloc_thread_info(tsk) \
62 ({ \ 70 ({ \
@@ -68,7 +76,7 @@ struct thread_info {
68 ret; \ 76 ret; \
69 }) 77 })
70#else 78#else
71#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) 79#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
72#endif 80#endif
73#define free_thread_info(ti) kfree(ti) 81#define free_thread_info(ti) kfree(ti)
74#define get_thread_info(ti) get_task_struct((ti)->task) 82#define get_thread_info(ti) get_task_struct((ti)->task)
@@ -77,9 +85,11 @@ struct thread_info {
77/* how to get the thread information struct from C */ 85/* how to get the thread information struct from C */
78static inline struct thread_info *current_thread_info(void) 86static inline struct thread_info *current_thread_info(void)
79{ 87{
80 struct thread_info *ti; 88 register unsigned long sp asm("r1");
81 __asm__("clrrdi %0,1,%1" : "=r"(ti) : "i" (THREAD_SHIFT)); 89
82 return ti; 90 /* gcc4, at least, is smart enough to turn this into a single
91 * rlwinm for ppc32 and clrrdi for ppc64 */
92 return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
83} 93}
84 94
85#endif /* __ASSEMBLY__ */ 95#endif /* __ASSEMBLY__ */
@@ -122,4 +132,4 @@ static inline struct thread_info *current_thread_info(void)
122 132
123#endif /* __KERNEL__ */ 133#endif /* __KERNEL__ */
124 134
125#endif /* _ASM_THREAD_INFO_H */ 135#endif /* _ASM_POWERPC_THREAD_INFO_H */
diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h
index 7043c164b537..c34fb4e37a97 100644
--- a/include/asm-ppc/ptrace.h
+++ b/include/asm-ppc/ptrace.h
@@ -57,7 +57,7 @@ extern unsigned long profile_pc(struct pt_regs *regs);
57 57
58#define force_successful_syscall_return() \ 58#define force_successful_syscall_return() \
59 do { \ 59 do { \
60 current_thread_info()->local_flags |= _TIFL_FORCE_NOERROR; \ 60 current_thread_info()->syscall_noerror = 1; \
61 } while(0) 61 } while(0)
62 62
63/* 63/*
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h
deleted file mode 100644
index 27903db42efc..000000000000
--- a/include/asm-ppc/thread_info.h
+++ /dev/null
@@ -1,107 +0,0 @@
1/* thread_info.h: PPC low-level thread information
2 * adapted from the i386 version by Paul Mackerras
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
7
8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H
10
11#ifdef __KERNEL__
12#ifndef __ASSEMBLY__
13/*
14 * low level task data.
15 * If you change this, change the TI_* offsets below to match.
16 */
17struct thread_info {
18 struct task_struct *task; /* main task structure */
19 struct exec_domain *exec_domain; /* execution domain */
20 unsigned long flags; /* low level flags */
21 unsigned long local_flags; /* non-racy flags */
22 int cpu; /* cpu we're on */
23 int preempt_count; /* 0 => preemptable,
24 <0 => BUG */
25 struct restart_block restart_block;
26};
27
28#define INIT_THREAD_INFO(tsk) \
29{ \
30 .task = &tsk, \
31 .exec_domain = &default_exec_domain, \
32 .flags = 0, \
33 .local_flags = 0, \
34 .cpu = 0, \
35 .preempt_count = 1, \
36 .restart_block = { \
37 .fn = do_no_restart_syscall, \
38 }, \
39}
40
41#define init_thread_info (init_thread_union.thread_info)
42#define init_stack (init_thread_union.stack)
43
44/*
45 * macros/functions for gaining access to the thread information structure
46 */
47
48/* how to get the thread information struct from C */
49static inline struct thread_info *current_thread_info(void)
50{
51 struct thread_info *ti;
52 __asm__("rlwinm %0,1,0,0,18" : "=r"(ti));
53 return ti;
54}
55
56/* thread information allocation */
57#define alloc_thread_info(tsk) ((struct thread_info *) \
58 __get_free_pages(GFP_KERNEL, 1))
59#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
60#define get_thread_info(ti) get_task_struct((ti)->task)
61#define put_thread_info(ti) put_task_struct((ti)->task)
62#endif /* __ASSEMBLY__ */
63
64/*
65 * Size of kernel stack for each process.
66 */
67#define THREAD_SIZE 8192 /* 2 pages */
68
69#define PREEMPT_ACTIVE 0x10000000
70
71/*
72 * thread information flag bit numbers
73 */
74#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
75#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
76#define TIF_SIGPENDING 2 /* signal pending */
77#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
78#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
79 TIF_NEED_RESCHED */
80#define TIF_MEMDIE 5
81#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
82#define TIF_SECCOMP 7 /* secure computing */
83
84/* as above, but as bit values */
85#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
86#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
87#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
88#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
89#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
90#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
91#define _TIF_SECCOMP (1<<TIF_SECCOMP)
92
93#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
94
95/*
96 * Non racy (local) flags bit numbers
97 */
98#define TIFL_FORCE_NOERROR 0 /* don't return error from current
99 syscall even if result < 0 */
100
101/* as above, but as bit values */
102#define _TIFL_FORCE_NOERROR (1<<TIFL_FORCE_NOERROR)
103
104
105#endif /* __KERNEL__ */
106
107#endif /* _ASM_THREAD_INFO_H */