HACK around apparently problematic return from calling C

* HACK ALERT!!! movl(%eax), %eax   --or--  movzbl(%eax), %eax
    * This pattern appears to be generated in some cases by the compiler.  It's not clear to me why it's a problem for
      the emulator (not a crash per se, but an emulation lock-up).
    * Current suspicion is that there are side-effects in the x86 flags from this instruction/indexing mode which are
      copied into the 6502 flags
    * Current sample code showing problem (and non-boot of emulator) is f785da40e9
This commit is contained in:
Aaron Culliney 2014-05-11 13:17:47 -07:00
parent 403cb8b154
commit 53a9cc3950

View File

@ -83,9 +83,13 @@ E(func) pushl XY_Regs_32; \
pushl FF_Reg; \
pushl SP_Reg; \
pushl PC_Reg_E; \
pushl %eax; /* HACK: works around mysterious issue with generated mov(%eax), %eax ... */ \
pushl EffectiveAddr_E; \
call SN(c_##func); \
popl %edx; /* dummy */ \
movb %al, %dl; \
popl %eax; /* ... ugh */ \
movb %dl, %al; \
popl PC_Reg_E; \
popl SP_Reg; \
popl FF_Reg; \