1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

LibJIT: Emit unwindable stack frames

Flip the order from save-registers,enter and leave,restore-registers
to enter,save-register and restore-registers,leave.

This way the return address is next to the saved frame pointer like
unwinding routines expect.
This commit is contained in:
Simon Wanner 2023-10-31 22:04:45 +01:00 committed by Andreas Kling
parent 93908fcbcb
commit 77dc7c4d36

View file

@ -522,19 +522,19 @@ struct Assembler {
void enter() void enter()
{ {
push_callee_saved_registers();
push(Operand::Register(Reg::RBP)); push(Operand::Register(Reg::RBP));
mov(Operand::Register(Reg::RBP), Operand::Register(Reg::RSP)); mov(Operand::Register(Reg::RBP), Operand::Register(Reg::RSP));
push_callee_saved_registers();
} }
void exit() void exit()
{ {
pop_callee_saved_registers();
// leave // leave
emit8(0xc9); emit8(0xc9);
pop_callee_saved_registers();
// ret // ret
emit8(0xc3); emit8(0xc3);
} }