Commit 64827454 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: eliminate useless thread field

This patch eliminates use of task.thread.kernel_stack.  It was unnecessary,
confusing, and was masking some kernel stack size assumptions.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6feb9cf3
...@@ -46,7 +46,7 @@ void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) ...@@ -46,7 +46,7 @@ void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int))
int flags = 0, pages; int flags = 0, pages;
if(sig_stack != NULL){ if(sig_stack != NULL){
pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2; pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER);
set_sigstack(sig_stack, pages * page_size()); set_sigstack(sig_stack, pages * page_size());
flags = SA_ONSTACK; flags = SA_ONSTACK;
} }
......
...@@ -166,8 +166,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -166,8 +166,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
struct pt_regs *regs) struct pt_regs *regs)
{ {
p->thread = (struct thread_struct) INIT_THREAD; p->thread = (struct thread_struct) INIT_THREAD;
p->thread.kernel_stack =
(unsigned long) p->thread_info + 2 * PAGE_SIZE;
return(CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, return(CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr,
clone_flags, sp, stack_top, p, regs)); clone_flags, sp, stack_top, p, regs));
} }
...@@ -327,8 +325,7 @@ int user_context(unsigned long sp) ...@@ -327,8 +325,7 @@ int user_context(unsigned long sp)
unsigned long stack; unsigned long stack;
stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER); stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER);
stack += 2 * PAGE_SIZE; return(stack != (unsigned long) current_thread);
return(stack != current->thread.kernel_stack);
} }
extern void remove_umid_dir(void); extern void remove_umid_dir(void);
......
...@@ -191,8 +191,7 @@ int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -191,8 +191,7 @@ int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp,
handler = new_thread_handler; handler = new_thread_handler;
} }
new_thread((void *) p->thread.kernel_stack, new_thread(p->thread_info, &p->thread.mode.skas.switch_buf,
&p->thread.mode.skas.switch_buf,
&p->thread.mode.skas.fork_buf, handler); &p->thread.mode.skas.fork_buf, handler);
return(0); return(0);
} }
...@@ -231,7 +230,7 @@ int start_uml_skas(void) ...@@ -231,7 +230,7 @@ int start_uml_skas(void)
init_task.thread.request.u.thread.proc = start_kernel_proc; init_task.thread.request.u.thread.proc = start_kernel_proc;
init_task.thread.request.u.thread.arg = NULL; init_task.thread.request.u.thread.arg = NULL;
return(start_idle_thread((void *) init_task.thread.kernel_stack, return(start_idle_thread(init_task.thread_info,
&init_task.thread.mode.skas.switch_buf, &init_task.thread.mode.skas.switch_buf,
&init_task.thread.mode.skas.fork_buf)); &init_task.thread.mode.skas.fork_buf));
} }
......
...@@ -39,8 +39,7 @@ void flush_thread_tt(void) ...@@ -39,8 +39,7 @@ void flush_thread_tt(void)
do_exit(SIGKILL); do_exit(SIGKILL);
} }
new_pid = start_fork_tramp((void *) current->thread.kernel_stack, new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp);
stack, 0, exec_tramp);
if(new_pid < 0){ if(new_pid < 0){
printk(KERN_ERR printk(KERN_ERR
"flush_thread : new thread failed, errno = %d\n", "flush_thread : new thread failed, errno = %d\n",
......
...@@ -248,8 +248,7 @@ int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -248,8 +248,7 @@ int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp,
clone_flags &= CLONE_VM; clone_flags &= CLONE_VM;
p->thread.temp_stack = stack; p->thread.temp_stack = stack;
new_pid = start_fork_tramp((void *) p->thread.kernel_stack, stack, new_pid = start_fork_tramp(p->thread_info, stack, clone_flags, tramp);
clone_flags, tramp);
if(new_pid < 0){ if(new_pid < 0){
printk(KERN_ERR "copy_thread : clone failed - errno = %d\n", printk(KERN_ERR "copy_thread : clone failed - errno = %d\n",
-new_pid); -new_pid);
...@@ -501,9 +500,9 @@ int start_uml_tt(void) ...@@ -501,9 +500,9 @@ int start_uml_tt(void)
void *sp; void *sp;
int pages; int pages;
pages = (1 << CONFIG_KERNEL_STACK_ORDER) - 2; pages = (1 << CONFIG_KERNEL_STACK_ORDER);
sp = (void *) init_task.thread.kernel_stack + pages * PAGE_SIZE - sp = (void *) ((unsigned long) init_task.thread_info) +
sizeof(unsigned long); pages * PAGE_SIZE - sizeof(unsigned long);
return(tracer(start_kernel_proc, sp)); return(tracer(start_kernel_proc, sp));
} }
......
...@@ -380,9 +380,6 @@ int linux_main(int argc, char **argv) ...@@ -380,9 +380,6 @@ int linux_main(int argc, char **argv)
uml_postsetup(); uml_postsetup();
init_task.thread.kernel_stack = (unsigned long) &init_thread_info +
2 * PAGE_SIZE;
task_protections((unsigned long) &init_thread_info); task_protections((unsigned long) &init_thread_info);
os_flush_stdout(); os_flush_stdout();
......
...@@ -22,7 +22,6 @@ struct mm_struct; ...@@ -22,7 +22,6 @@ struct mm_struct;
struct thread_struct { struct thread_struct {
int forking; int forking;
unsigned long kernel_stack;
int nsyscalls; int nsyscalls;
struct pt_regs regs; struct pt_regs regs;
unsigned long cr2; unsigned long cr2;
...@@ -73,7 +72,6 @@ struct thread_struct { ...@@ -73,7 +72,6 @@ struct thread_struct {
#define INIT_THREAD \ #define INIT_THREAD \
{ \ { \
.forking = 0, \ .forking = 0, \
.kernel_stack = 0, \
.nsyscalls = 0, \ .nsyscalls = 0, \
.regs = EMPTY_REGS, \ .regs = EMPTY_REGS, \
.cr2 = 0, \ .cr2 = 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