mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
rt: Zero the bottom frame's return address and base pointer
My reading of libunwind leads me to believe this is expected. Closes #1322
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user