aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/thread_info.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/thread_info.h')
-rw-r--r--arch/x86/include/asm/thread_info.h53
1 files changed, 5 insertions, 48 deletions
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index e1940c06ed02..47e5de25ba79 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <asm/page.h> 11#include <asm/page.h>
12#include <asm/percpu.h>
12#include <asm/types.h> 13#include <asm/types.h>
13 14
14/* 15/*
@@ -32,12 +33,6 @@ struct thread_info {
32 mm_segment_t addr_limit; 33 mm_segment_t addr_limit;
33 struct restart_block restart_block; 34 struct restart_block restart_block;
34 void __user *sysenter_return; 35 void __user *sysenter_return;
35#ifdef CONFIG_X86_32
36 unsigned long previous_esp; /* ESP of the previous stack in
37 case of nested (IRQ) stacks
38 */
39 __u8 supervisor_stack[0];
40#endif
41 unsigned int sig_on_uaccess_error:1; 36 unsigned int sig_on_uaccess_error:1;
42 unsigned int uaccess_err:1; /* uaccess failed */ 37 unsigned int uaccess_err:1; /* uaccess failed */
43}; 38};
@@ -153,9 +148,9 @@ struct thread_info {
153#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) 148#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
154#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) 149#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)
155 150
156#ifdef CONFIG_X86_32 151#define STACK_WARN (THREAD_SIZE/8)
152#define KERNEL_STACK_OFFSET (5*(BITS_PER_LONG/8))
157 153
158#define STACK_WARN (THREAD_SIZE/8)
159/* 154/*
160 * macros/functions for gaining access to the thread information structure 155 * macros/functions for gaining access to the thread information structure
161 * 156 *
@@ -163,42 +158,6 @@ struct thread_info {
163 */ 158 */
164#ifndef __ASSEMBLY__ 159#ifndef __ASSEMBLY__
165 160
166#define current_stack_pointer ({ \
167 unsigned long sp; \
168 asm("mov %%esp,%0" : "=g" (sp)); \
169 sp; \
170})
171
172/* how to get the thread information struct from C */
173static inline struct thread_info *current_thread_info(void)
174{
175 return (struct thread_info *)
176 (current_stack_pointer & ~(THREAD_SIZE - 1));
177}
178
179#else /* !__ASSEMBLY__ */
180
181/* how to get the thread information struct from ASM */
182#define GET_THREAD_INFO(reg) \
183 movl $-THREAD_SIZE, reg; \
184 andl %esp, reg
185
186/* use this one if reg already contains %esp */
187#define GET_THREAD_INFO_WITH_ESP(reg) \
188 andl $-THREAD_SIZE, reg
189
190#endif
191
192#else /* X86_32 */
193
194#include <asm/percpu.h>
195#define KERNEL_STACK_OFFSET (5*8)
196
197/*
198 * macros/functions for gaining access to the thread information structure
199 * preempt_count needs to be 1 initially, until the scheduler is functional.
200 */
201#ifndef __ASSEMBLY__
202DECLARE_PER_CPU(unsigned long, kernel_stack); 161DECLARE_PER_CPU(unsigned long, kernel_stack);
203 162
204static inline struct thread_info *current_thread_info(void) 163static inline struct thread_info *current_thread_info(void)
@@ -213,8 +172,8 @@ static inline struct thread_info *current_thread_info(void)
213 172
214/* how to get the thread information struct from ASM */ 173/* how to get the thread information struct from ASM */
215#define GET_THREAD_INFO(reg) \ 174#define GET_THREAD_INFO(reg) \
216 movq PER_CPU_VAR(kernel_stack),reg ; \ 175 _ASM_MOV PER_CPU_VAR(kernel_stack),reg ; \
217 subq $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg 176 _ASM_SUB $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg ;
218 177
219/* 178/*
220 * Same if PER_CPU_VAR(kernel_stack) is, perhaps with some offset, already in 179 * Same if PER_CPU_VAR(kernel_stack) is, perhaps with some offset, already in
@@ -224,8 +183,6 @@ static inline struct thread_info *current_thread_info(void)
224 183
225#endif 184#endif
226 185
227#endif /* !X86_32 */
228
229/* 186/*
230 * Thread-synchronous status. 187 * Thread-synchronous status.
231 * 188 *