Skip to content

Commit e1a79c4

Browse files
cfd-36Linus Torvalds
authored andcommitted
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: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 57598fd commit e1a79c4

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎arch/um/kernel/init_task.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ __attribute__((__section__(".data.init_task"))) =
4444

4545
void unprotect_stack(unsigned long stack)
4646
{
47-
os_protect_memory((void *) stack, (1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE,
48-
1, 1, 0);
47+
os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
4948
}
5049

5150
/*

‎arch/um/os-Linux/skas/process.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ void map_stub_pages(int fd, unsigned long code,
490490
void new_thread(void *stack, jmp_buf *buf, void (*handler)(void))
491491
{
492492
(*buf)[0].JB_IP = (unsigned long) handler;
493-
(*buf)[0].JB_SP = (unsigned long) stack +
494-
(PAGE_SIZE << UML_CONFIG_KERNEL_STACK_ORDER) - sizeof(void *);
493+
(*buf)[0].JB_SP = (unsigned long) stack + UM_THREAD_SIZE -
494+
sizeof(void *);
495495
}
496496

497497
#define INIT_JMP_NEW_THREAD 0
@@ -533,8 +533,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
533533
case INIT_JMP_NEW_THREAD:
534534
(*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
535535
(*switch_buf)[0].JB_SP = (unsigned long) stack +
536-
(PAGE_SIZE << UML_CONFIG_KERNEL_STACK_ORDER) -
537-
sizeof(void *);
536+
UM_THREAD_SIZE - sizeof(void *);
538537
break;
539538
case INIT_JMP_CALLBACK:
540539
(*cb_proc)(cb_arg);

0 commit comments

Comments
 (0)