New macro to fill a new process stack: in this way the stack is always aligned.
[bertos.git] / bertos / kern / proc.c
index 267ace6c4572d6e8f107e8a641ecffdd98aeda36..15fe5b7f79112bf6b36662611e603148692c6036 100644 (file)
@@ -240,17 +240,9 @@ struct Process *proc_new_with_name(UNUSED_ARG(const char *, name), void (*entry)
                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));
-       }
+       
+               CPU_CREATE_NEW_STACK(proc->stack, entry, proc_exit);
+               
        #endif // CONFIG_KERN_PREEMPT
 
        #if CONFIG_KERN_MONITOR