diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2006-01-12 04:06:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 12:08:57 -0500 |
commit | 0cec6fd1370807f98934e84c9e6147335b81d8a5 (patch) | |
tree | ead813727b785ec973ef88158895cca381a25027 /arch | |
parent | b5e2fc1c6259e6f26bc4ae4de697da1f8da0edec (diff) |
[PATCH] powerpc: task_stack_page()
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')
-rw-r--r-- | arch/powerpc/kernel/process.c | 10 | ||||
-rw-r--r-- | arch/ppc/kernel/process.c | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index bc03526d25de..1f816f0d7740 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -503,7 +503,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
503 | { | 503 | { |
504 | struct pt_regs *childregs, *kregs; | 504 | struct pt_regs *childregs, *kregs; |
505 | extern void ret_from_fork(void); | 505 | extern void ret_from_fork(void); |
506 | unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; | 506 | unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; |
507 | 507 | ||
508 | CHECK_FULL_REGS(regs); | 508 | CHECK_FULL_REGS(regs); |
509 | /* Copy registers */ | 509 | /* Copy registers */ |
@@ -588,10 +588,8 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) | |||
588 | * set. Do it now. | 588 | * set. Do it now. |
589 | */ | 589 | */ |
590 | if (!current->thread.regs) { | 590 | if (!current->thread.regs) { |
591 | unsigned long childregs = (unsigned long)current->thread_info + | 591 | struct pt_regs *regs = task_stack_page(current) + THREAD_SIZE; |
592 | THREAD_SIZE; | 592 | current->thread.regs = regs - 1; |
593 | childregs -= sizeof(struct pt_regs); | ||
594 | current->thread.regs = (struct pt_regs *)childregs; | ||
595 | } | 593 | } |
596 | 594 | ||
597 | memset(regs->gpr, 0, sizeof(regs->gpr)); | 595 | memset(regs->gpr, 0, sizeof(regs->gpr)); |
@@ -767,7 +765,7 @@ out: | |||
767 | static int validate_sp(unsigned long sp, struct task_struct *p, | 765 | static int validate_sp(unsigned long sp, struct task_struct *p, |
768 | unsigned long nbytes) | 766 | unsigned long nbytes) |
769 | { | 767 | { |
770 | unsigned long stack_page = (unsigned long)p->thread_info; | 768 | unsigned long stack_page = (unsigned long)task_stack_page(p); |
771 | 769 | ||
772 | if (sp >= stack_page + sizeof(struct thread_struct) | 770 | if (sp >= stack_page + sizeof(struct thread_struct) |
773 | && sp <= stack_page + THREAD_SIZE - nbytes) | 771 | && sp <= stack_page + THREAD_SIZE - nbytes) |
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c index c3555a8f2c8d..a76b504299ca 100644 --- a/arch/ppc/kernel/process.c +++ b/arch/ppc/kernel/process.c | |||
@@ -482,7 +482,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
482 | { | 482 | { |
483 | struct pt_regs *childregs, *kregs; | 483 | struct pt_regs *childregs, *kregs; |
484 | extern void ret_from_fork(void); | 484 | extern void ret_from_fork(void); |
485 | unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; | 485 | unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; |
486 | unsigned long childframe; | 486 | unsigned long childframe; |
487 | 487 | ||
488 | CHECK_FULL_REGS(regs); | 488 | CHECK_FULL_REGS(regs); |
@@ -702,8 +702,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) | |||
702 | sp = tsk->thread.ksp; | 702 | sp = tsk->thread.ksp; |
703 | } | 703 | } |
704 | 704 | ||
705 | prev_sp = (unsigned long) (tsk->thread_info + 1); | 705 | prev_sp = (unsigned long) end_of_stack(tsk); |
706 | stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE; | 706 | stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE; |
707 | while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) { | 707 | while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) { |
708 | if (count == 0) { | 708 | if (count == 0) { |
709 | printk("Call trace:"); | 709 | printk("Call trace:"); |
@@ -832,7 +832,7 @@ void __init ll_puts(const char *s) | |||
832 | unsigned long get_wchan(struct task_struct *p) | 832 | unsigned long get_wchan(struct task_struct *p) |
833 | { | 833 | { |
834 | unsigned long ip, sp; | 834 | unsigned long ip, sp; |
835 | unsigned long stack_page = (unsigned long) p->thread_info; | 835 | unsigned long stack_page = (unsigned long) task_stack_page(p); |
836 | int count = 0; | 836 | int count = 0; |
837 | if (!p || p == current || p->state == TASK_RUNNING) | 837 | if (!p || p == current || p->state == TASK_RUNNING) |
838 | return 0; | 838 | return 0; |