diff options
Diffstat (limited to 'arch/i386/kernel/process.c')
| -rw-r--r-- | arch/i386/kernel/process.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 5dd03757f50c..3d7e0c8e9925 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, | |||
| 424 | struct task_struct *tsk; | 424 | struct task_struct *tsk; |
| 425 | int err; | 425 | int err; |
| 426 | 426 | ||
| 427 | childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; | 427 | childregs = task_pt_regs(p); |
| 428 | /* | ||
| 429 | * The below -8 is to reserve 8 bytes on top of the ring0 stack. | ||
| 430 | * This is necessary to guarantee that the entire "struct pt_regs" | ||
| 431 | * is accessable even if the CPU haven't stored the SS/ESP registers | ||
| 432 | * on the stack (interrupt gate does not save these registers | ||
| 433 | * when switching to the same priv ring). | ||
| 434 | * Therefore beware: accessing the xss/esp fields of the | ||
| 435 | * "struct pt_regs" is possible, but they may contain the | ||
| 436 | * completely wrong values. | ||
| 437 | */ | ||
| 438 | childregs = (struct pt_regs *) ((unsigned long) childregs - 8); | ||
| 439 | *childregs = *regs; | 428 | *childregs = *regs; |
| 440 | childregs->eax = 0; | 429 | childregs->eax = 0; |
| 441 | childregs->esp = esp; | 430 | childregs->esp = esp; |
| @@ -540,12 +529,7 @@ EXPORT_SYMBOL(dump_thread); | |||
| 540 | */ | 529 | */ |
| 541 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | 530 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) |
| 542 | { | 531 | { |
| 543 | struct pt_regs ptregs; | 532 | struct pt_regs ptregs = *task_pt_regs(tsk); |
| 544 | |||
| 545 | ptregs = *(struct pt_regs *) | ||
| 546 | ((unsigned long)tsk->thread_info + | ||
| 547 | /* see comments in copy_thread() about -8 */ | ||
| 548 | THREAD_SIZE - sizeof(ptregs) - 8); | ||
| 549 | ptregs.xcs &= 0xffff; | 533 | ptregs.xcs &= 0xffff; |
| 550 | ptregs.xds &= 0xffff; | 534 | ptregs.xds &= 0xffff; |
| 551 | ptregs.xes &= 0xffff; | 535 | ptregs.xes &= 0xffff; |
