Commit 0cec6fd1 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] powerpc: task_stack_page()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b5e2fc1c
...@@ -503,7 +503,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -503,7 +503,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
{ {
struct pt_regs *childregs, *kregs; struct pt_regs *childregs, *kregs;
extern void ret_from_fork(void); 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); CHECK_FULL_REGS(regs);
/* Copy registers */ /* Copy registers */
...@@ -588,10 +588,8 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) ...@@ -588,10 +588,8 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
* set. Do it now. * set. Do it now.
*/ */
if (!current->thread.regs) { if (!current->thread.regs) {
unsigned long childregs = (unsigned long)current->thread_info + struct pt_regs *regs = task_stack_page(current) + THREAD_SIZE;
THREAD_SIZE; current->thread.regs = regs - 1;
childregs -= sizeof(struct pt_regs);
current->thread.regs = (struct pt_regs *)childregs;
} }
memset(regs->gpr, 0, sizeof(regs->gpr)); memset(regs->gpr, 0, sizeof(regs->gpr));
...@@ -767,7 +765,7 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, ...@@ -767,7 +765,7 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
static int validate_sp(unsigned long sp, struct task_struct *p, static int validate_sp(unsigned long sp, struct task_struct *p,
unsigned long nbytes) 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) if (sp >= stack_page + sizeof(struct thread_struct)
&& sp <= stack_page + THREAD_SIZE - nbytes) && sp <= stack_page + THREAD_SIZE - nbytes)
......
...@@ -482,7 +482,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -482,7 +482,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
{ {
struct pt_regs *childregs, *kregs; struct pt_regs *childregs, *kregs;
extern void ret_from_fork(void); 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; unsigned long childframe;
CHECK_FULL_REGS(regs); CHECK_FULL_REGS(regs);
...@@ -702,8 +702,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) ...@@ -702,8 +702,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
sp = tsk->thread.ksp; sp = tsk->thread.ksp;
} }
prev_sp = (unsigned long) (tsk->thread_info + 1); prev_sp = (unsigned long) end_of_stack(tsk);
stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE; stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE;
while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) { while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
if (count == 0) { if (count == 0) {
printk("Call trace:"); printk("Call trace:");
...@@ -832,7 +832,7 @@ void __init ll_puts(const char *s) ...@@ -832,7 +832,7 @@ void __init ll_puts(const char *s)
unsigned long get_wchan(struct task_struct *p) unsigned long get_wchan(struct task_struct *p)
{ {
unsigned long ip, sp; 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; int count = 0;
if (!p || p == current || p->state == TASK_RUNNING) if (!p || p == current || p->state == TASK_RUNNING)
return 0; return 0;
......
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