Commit 39c203fd authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] x86: remove THREAD_SIZE assumption cleanups

From: Arjan van de Ven <arjanv@redhat.com>

some more hardcoded THREAD_SIZE cleanups.
parent 895f649e
...@@ -162,7 +162,7 @@ do_lcall: ...@@ -162,7 +162,7 @@ do_lcall:
movl %eax,EFLAGS(%ebp) # movl %eax,EFLAGS(%ebp) #
movl %edx,EIP(%ebp) # Now we move them to their "normal" places movl %edx,EIP(%ebp) # Now we move them to their "normal" places
movl %ecx,CS(%ebp) # movl %ecx,CS(%ebp) #
andl $-8192, %ebp # GET_THREAD_INFO GET_THREAD_INFO_WITH_ESP(%ebp) # GET_THREAD_INFO
movl TI_EXEC_DOMAIN(%ebp), %edx # Get the execution domain movl TI_EXEC_DOMAIN(%ebp), %edx # Get the execution domain
call *4(%edx) # Call the lcall7 handler for the domain call *4(%edx) # Call the lcall7 handler for the domain
addl $4, %esp addl $4, %esp
......
...@@ -489,8 +489,24 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); ...@@ -489,8 +489,24 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
void show_trace(struct task_struct *task, unsigned long *stack); void show_trace(struct task_struct *task, unsigned long *stack);
unsigned long get_wchan(struct task_struct *p); unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019])
#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1022]) #define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
#define KSTK_TOP(info) \
({ \
unsigned long *__ptr = (unsigned long *)(info); \
(unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \
})
#define task_pt_regs(task) \
({ \
struct pt_regs *__regs__; \
__regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info); \
__regs__ - 1; \
})
#define KSTK_EIP(task) (task_pt_regs(task)->eip)
#define KSTK_ESP(task) (task_pt_regs(task)->esp)
struct microcode_header { struct microcode_header {
unsigned int hdrver; unsigned int hdrver;
......
...@@ -115,6 +115,10 @@ static inline struct thread_info *current_thread_info(void) ...@@ -115,6 +115,10 @@ static inline struct thread_info *current_thread_info(void)
movl $-THREAD_SIZE, reg; \ movl $-THREAD_SIZE, reg; \
andl %esp, reg andl %esp, reg
/* use this one if reg already contains %esp */
#define GET_THREAD_INFO_WITH_ESP(reg) \
andl $-THREAD_SIZE, reg
#endif #endif
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment