diff --git a/src/rt/arch/i386/context.cpp b/src/rt/arch/i386/context.cpp index f5fa3777eec3..e65420dc0e31 100644 --- a/src/rt/arch/i386/context.cpp +++ b/src/rt/arch/i386/context.cpp @@ -31,10 +31,14 @@ void context::call(void *f, void *arg, void *stack) { // Shift the stack pointer so the alignment works out right. sp = align_down(sp) - 3; *--sp = (uint32_t)arg; - *--sp = 0xdeadbeef; + // The final return address. 0 indicates the bottom of the stack + *--sp = 0; regs.esp = (uint32_t)sp; regs.eip = (uint32_t)f; + + // Last base pointer on the stack should be 0 + regs.ebp = 0; } #if 0 diff --git a/src/rt/arch/x86_64/context.cpp b/src/rt/arch/x86_64/context.cpp index d9070c6385a2..46a606c6c6e0 100644 --- a/src/rt/arch/x86_64/context.cpp +++ b/src/rt/arch/x86_64/context.cpp @@ -28,9 +28,13 @@ void context::call(void *f, void *arg, void *stack) { // set up the stack uint64_t *sp = (uint64_t *)stack; sp = align_down(sp); - *--sp = 0xdeadbeef; // takes place of ret. addr. + // The final return address. 0 indicates the bottom of the stack + *--sp = 0; regs.data[RUSTRT_ARG0] = (uint64_t)arg; regs.data[RUSTRT_RSP] = (uint64_t)sp; regs.data[RUSTRT_IP] = (uint64_t)f; + + // Last base pointer on the stack should be 0 + regs.data[RUSTRT_RBP] = 0; }