]> err.no Git - linux-2.6/commitdiff
[PATCH] powerpc: task_stack_page()
authorAl Viro <viro@ftp.linux.org.uk>
Thu, 12 Jan 2006 09:06:02 +0000 (01:06 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 12 Jan 2006 17:08:57 +0000 (09:08 -0800)
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>
arch/powerpc/kernel/process.c
arch/ppc/kernel/process.c

index bc03526d25de4ce7f72ce9fbbb1322c1e1393416..1f816f0d7740eb4e7a9601a34faabcb9f4995a69 100644 (file)
@@ -503,7 +503,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs *childregs, *kregs;
        extern void ret_from_fork(void);
-       unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
+       unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
 
        CHECK_FULL_REGS(regs);
        /* Copy registers */
@@ -588,10 +588,8 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
         * set.  Do it now.
         */
        if (!current->thread.regs) {
-               unsigned long childregs = (unsigned long)current->thread_info +
-                                               THREAD_SIZE;
-               childregs -= sizeof(struct pt_regs);
-               current->thread.regs = (struct pt_regs *)childregs;
+               struct pt_regs *regs = task_stack_page(current) + THREAD_SIZE;
+               current->thread.regs = regs - 1;
        }
 
        memset(regs->gpr, 0, sizeof(regs->gpr));
@@ -767,7 +765,7 @@ out:
 static int validate_sp(unsigned long sp, struct task_struct *p,
                       unsigned long nbytes)
 {
-       unsigned long stack_page = (unsigned long)p->thread_info;
+       unsigned long stack_page = (unsigned long)task_stack_page(p);
 
        if (sp >= stack_page + sizeof(struct thread_struct)
            && sp <= stack_page + THREAD_SIZE - nbytes)
index c3555a8f2c8d2340c96d4c39a1d5aad415f2005b..a76b504299ca09eb801353c8bef99019b563fe81 100644 (file)
@@ -482,7 +482,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs *childregs, *kregs;
        extern void ret_from_fork(void);
-       unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
+       unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
        unsigned long childframe;
 
        CHECK_FULL_REGS(regs);
@@ -702,8 +702,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
                        sp = tsk->thread.ksp;
        }
 
-       prev_sp = (unsigned long) (tsk->thread_info + 1);
-       stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
+       prev_sp = (unsigned long) end_of_stack(tsk);
+       stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE;
        while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
                if (count == 0) {
                        printk("Call trace:");
@@ -832,7 +832,7 @@ void __init ll_puts(const char *s)
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long ip, sp;
-       unsigned long stack_page = (unsigned long) p->thread_info;
+       unsigned long stack_page = (unsigned long) task_stack_page(p);
        int count = 0;
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;