microcode/cmpauxmd/x86-64.m4: Restore frame pointer after callback.
authorMatt Birkholz <matt@birchwood-abbey.net>
Tue, 12 Sep 2017 02:00:01 +0000 (19:00 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Tue, 12 Sep 2017 02:00:01 +0000 (19:00 -0700)
src/microcode/cmpauxmd/x86-64.m4

index a03136cc4a7aeffc89051257410d292b9f26fa4f..d43e7ef607b193b0e34e1311291336077dfeb364 100644 (file)
@@ -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))