proc_exit(): Free the correct stack base pointer.
[bertos.git] / bertos / kern / proc.c
index 0e3edbea37e368bfac54003ee9667d1cc0c7f042..c3d89b4315d499048b1a859e044dd7c2b6f61305 100644 (file)
@@ -286,10 +286,8 @@ void proc_exit(void)
 #endif
 
 #if (ARCH & ARCH_EMUL)
-#warning This is wrong
        /* Reinsert process stack in free list */
-       PROC_ATOMIC(ADDHEAD(&StackFreeList, (Node *)(CurrentProcess->stack
-               - (CONFIG_PROC_DEFSTACKSIZE / sizeof(cpustack_t)))));
+       PROC_ATOMIC(ADDHEAD(&StackFreeList, (Node *)CurrentProcess->stack_base));
 
        /*
         * NOTE: At this point the first two words of what used