From: Matthias Kruk Date: Tue, 1 Oct 2019 07:01:49 +0000 (+0900) Subject: Don't perform arithmetic on the stack pointer arguments within task_prepare, i.e... X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=d0b1182a64ddc13743bd7762cdc7754880c07c04;p=corax Don't perform arithmetic on the stack pointer arguments within task_prepare, i.e. the caller is expected to provide the correct addresses where the stacks may be placed --- diff --git a/kernel/arch/task.S b/kernel/arch/task.S index bd092ea..032e2a5 100644 --- a/kernel/arch/task.S +++ b/kernel/arch/task.S @@ -53,7 +53,6 @@ task_prepare: /* calculate stack start (since it grows down) */ movl 16(%esp), %eax - addl $CONFIG_KERNEL_STACK_SIZE, %eax /* * We will use _int_restore (the lower half of the interrupt handler) diff --git a/kernel/core/process.c b/kernel/core/process.c index 387907c..8a4429d 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -48,7 +48,8 @@ int process_create(process_t **dst, u32_t ppl, void *entry) proc->p_privl = ppl; task_prepare(proc->p_tasks, (u32_t)pdbr, (u32_t)entry, - (u32_t)kstack, (u32_t)ustack + PAGE_SIZE, ppl); + (u32_t)kstack + CONFIG_KERNEL_STACK_SIZE, + (u32_t)ustack + CONFIG_USER_STACK_SIZE, ppl); proc->p_tasks->t_sp = (u32_t)(CONFIG_KERNEL_STACK_BASE + ((u32_t)proc->p_tasks->t_sp - (u32_t)kstack));