From 2a9449cc143eb682be83717500889c06adf2fde6 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 11 Sep 2017 19:00:01 -0700 Subject: [PATCH] microcode/cmpauxmd/x86-64.m4: Restore frame pointer after callback. --- src/microcode/cmpauxmd/x86-64.m4 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/microcode/cmpauxmd/x86-64.m4 b/src/microcode/cmpauxmd/x86-64.m4 index a03136cc4..d43e7ef60 100644 --- a/src/microcode/cmpauxmd/x86-64.m4 +++ b/src/microcode/cmpauxmd/x86-64.m4 @@ -472,11 +472,14 @@ ifdef(`WIN32', # Register block = %rsi ` OP(lea,q) TW(ABS(EVR(Registers)),regs)') OP(mov,q) TW(ABS(EVR(Free)),rfree) # Free pointer = %rdi OP(mov,q) TW(QOF(REGBLOCK_VAL(),regs),REG(rax)) # Value/dynamic link - OP(mov,q) TW(IMM(ADDRESS_MASK),rmask) # = %rbp # Restore the C stack pointer, which we zeroed back in # scheme_to_interface, for within_c_stack. + # Restore the C frame pointer too; the interface may have called + # Re_Enter_Interpreter which probably clobbered both. OP(mov,q) TW(REG(rsp),ABS(EVR(C_Stack_Pointer))) OP(mov,q) TW(ABS(EVR(stack_pointer)),REG(rsp)) + OP(mov,q) TW(REG(rbp),ABS(EVR(C_Frame_Pointer))) + OP(mov,q) TW(IMM(ADDRESS_MASK),rmask) # = %rbp OP(mov,q) TW(REG(rax),REG(rcx)) # Preserve if used OP(and,q) TW(rmask,REG(rcx)) # Restore potential dynamic link OP(mov,q) TW(REG(rcx),QOF(REGBLOCK_DLINK(),regs)) -- 2.25.1