From 0c25ec25d61d8edbe9cc52b0c0f6caa468a1fa2e Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 10 May 2014 16:45:10 -0700 Subject: [PATCH] Save/restore other crucial registers for safety --- src/asm386/glue-prologue.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/asm386/glue-prologue.h b/src/asm386/glue-prologue.h index c512739b..76a7d850 100644 --- a/src/asm386/glue-prologue.h +++ b/src/asm386/glue-prologue.h @@ -60,30 +60,35 @@ E(func) addl SN(pointer),%edi; \ // TODO FIXME : implement CDECL prologue/epilogues... #define GLUE_C_WRITE(func) \ E(func) pushl %eax; \ + pushl XY_Regs_32; \ pushl FF_Reg; \ pushl SP_Reg; \ + pushl PC_Reg_E; \ andl $0xff,%eax; \ pushl %eax; \ pushl EffectiveAddr_E; \ call SN(c_##func); \ popl %edx; /* dummy */ \ popl %edx; /* dummy */ \ + popl PC_Reg_E; \ popl SP_Reg; \ popl FF_Reg; \ + popl XY_Regs_32; \ popl %eax; \ ret; // TODO FIXME : implement CDECL prologue/epilogues... #define GLUE_C_READ(func) \ -E(func) /*pushl %eax;*/ \ +E(func) pushl XY_Regs_32; \ pushl FF_Reg; \ pushl SP_Reg; \ + pushl PC_Reg_E; \ pushl EffectiveAddr_E; \ call SN(c_##func); \ - /*movb %al,12(%esp);*/ \ popl %edx; /* dummy */ \ + popl PC_Reg_E; \ popl SP_Reg; \ popl FF_Reg; \ - /*popl %eax;*/ \ + popl XY_Regs_32; \ ret;