diff options
author | akpm@osdl.org <akpm@osdl.org> | 2006-01-12 01:05:41 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 09:08:52 -0800 |
commit | 07b047fc2466249aff7cdb23fa0b0955a7a00d48 (patch) | |
tree | af22cc80470f8aff6d0c25276ef8fae2b3f537a7 /arch/i386 | |
parent | 06b425d80f56280e698b3e8487c372e0d39d9ba1 (diff) | |
download | op-kernel-dev-07b047fc2466249aff7cdb23fa0b0955a7a00d48.zip op-kernel-dev-07b047fc2466249aff7cdb23fa0b0955a7a00d48.tar.gz |
[PATCH] i386: fix task_pt_regs()
)
From: Al Viro <viro@ftp.linux.org.uk>
task_pt_regs() needs the same offset-by-8 to match copy_thread()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/process.c | 20 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 3 |
2 files changed, 3 insertions, 20 deletions
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 5dd0375..3d7e0c8 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -424,18 +424,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, struct task_struct *tsk; int err; - childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; - /* - * The below -8 is to reserve 8 bytes on top of the ring0 stack. - * This is necessary to guarantee that the entire "struct pt_regs" - * is accessable even if the CPU haven't stored the SS/ESP registers - * on the stack (interrupt gate does not save these registers - * when switching to the same priv ring). - * Therefore beware: accessing the xss/esp fields of the - * "struct pt_regs" is possible, but they may contain the - * completely wrong values. - */ - childregs = (struct pt_regs *) ((unsigned long) childregs - 8); + childregs = task_pt_regs(p); *childregs = *regs; childregs->eax = 0; childregs->esp = esp; @@ -540,12 +529,7 @@ EXPORT_SYMBOL(dump_thread); */ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) { - struct pt_regs ptregs; - - ptregs = *(struct pt_regs *) - ((unsigned long)tsk->thread_info + - /* see comments in copy_thread() about -8 */ - THREAD_SIZE - sizeof(ptregs) - 8); + struct pt_regs ptregs = *task_pt_regs(tsk); ptregs.xcs &= 0xffff; ptregs.xds &= 0xffff; ptregs.xes &= 0xffff; diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index a9bf5f2..255adb4 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -875,8 +875,7 @@ static inline struct task_struct * alloc_idle_task(int cpu) /* initialize thread_struct. we really want to avoid destroy * idle tread */ - idle->thread.esp = (unsigned long)(((struct pt_regs *) - (THREAD_SIZE + (unsigned long) idle->thread_info)) - 1); + idle->thread.esp = (unsigned long)task_pt_regs(idle); init_idle(idle, cpu); return idle; } |