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

uml: use UM_THREAD_SIZE in userspace code

Now that we have UM_THREAD_SIZE, we can replace the calculations in
user-space code (an earlier patch took care of the kernel side of the
house).
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 57598fd7
...@@ -44,8 +44,7 @@ __attribute__((__section__(".data.init_task"))) = ...@@ -44,8 +44,7 @@ __attribute__((__section__(".data.init_task"))) =
void unprotect_stack(unsigned long stack) void unprotect_stack(unsigned long stack)
{ {
os_protect_memory((void *) stack, (1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE, os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
1, 1, 0);
} }
/* /*
......
...@@ -490,8 +490,8 @@ void map_stub_pages(int fd, unsigned long code, ...@@ -490,8 +490,8 @@ void map_stub_pages(int fd, unsigned long code,
void new_thread(void *stack, jmp_buf *buf, void (*handler)(void)) void new_thread(void *stack, jmp_buf *buf, void (*handler)(void))
{ {
(*buf)[0].JB_IP = (unsigned long) handler; (*buf)[0].JB_IP = (unsigned long) handler;
(*buf)[0].JB_SP = (unsigned long) stack + (*buf)[0].JB_SP = (unsigned long) stack + UM_THREAD_SIZE -
(PAGE_SIZE << UML_CONFIG_KERNEL_STACK_ORDER) - sizeof(void *); sizeof(void *);
} }
#define INIT_JMP_NEW_THREAD 0 #define INIT_JMP_NEW_THREAD 0
...@@ -533,8 +533,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) ...@@ -533,8 +533,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
case INIT_JMP_NEW_THREAD: case INIT_JMP_NEW_THREAD:
(*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler; (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
(*switch_buf)[0].JB_SP = (unsigned long) stack + (*switch_buf)[0].JB_SP = (unsigned long) stack +
(PAGE_SIZE << UML_CONFIG_KERNEL_STACK_ORDER) - UM_THREAD_SIZE - sizeof(void *);
sizeof(void *);
break; break;
case INIT_JMP_CALLBACK: case INIT_JMP_CALLBACK:
(*cb_proc)(cb_arg); (*cb_proc)(cb_arg);
......
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