-#if CONFIG_KERN_PREEMPT
- // FIXME: proc_exit
- getcontext(&proc->context);
- proc->context.uc_stack.ss_sp = stack_base;
- proc->context.uc_stack.ss_size = stack_size;
- proc->context.uc_link = NULL;
- makecontext(&proc->context, entry, 0);
-
-#else // !CONFIG_KERN_PREEMPT
- /* Initialize process stack frame */
- CPU_PUSH_CALL_FRAME(proc->stack, proc_exit);
- CPU_PUSH_CALL_FRAME(proc->stack, entry);
-
- /* Push a clean set of CPU registers for asm_switch_context() */
- for (i = 0; i < CPU_SAVED_REGS_CNT; i++)
- CPU_PUSH_WORD(proc->stack, CPU_REG_INIT_VALUE(i));
+ #if CONFIG_KERN_PREEMPT
+ // FIXME: proc_exit
+ getcontext(&proc->context);
+ proc->context.uc_stack.ss_sp = stack_base;
+ proc->context.uc_stack.ss_size = stack_size;
+ proc->context.uc_link = NULL;
+ makecontext(&proc->context, (void (*)(void))proc_entry, 1, entry);
+
+ #else // !CONFIG_KERN_PREEMPT
+ {
+ size_t i;
+
+ /* Initialize process stack frame */
+ CPU_PUSH_CALL_FRAME(proc->stack, proc_exit);
+ CPU_PUSH_CALL_FRAME(proc->stack, entry);
+
+ /* Push a clean set of CPU registers for asm_switch_context() */
+ for (i = 0; i < CPU_SAVED_REGS_CNT; i++)
+ CPU_PUSH_WORD(proc->stack, CPU_REG_INIT_VALUE(i));
+ }
+ #endif // CONFIG_KERN_PREEMPT