Re: savestate investigation revisited, aka I don't think its a compiler bug after all.
When making a savestate with SekScan(), it dumps the entire structure m68ki_cpu_core to the savestate. At the bottom of the structure are a bunch of pointers:
uint8* cyc_instruction;
uint8* cyc_exception;
/* Callbacks to host */
int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */
void (*bkpt_ack_callback)(unsigned int data); /* Breakpoint Acknowledge */
void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */
void (*cmpild_instr_callback)(unsigned int, int); /* Called when a CMPI.L #v, Dn instruction is encountered */
void (*rte_instr_callback)(void); /* Called when a RTE instruction is encountered */
void (*pc_changed_callback)(unsigned int new_pc); /* Called when the PC changes by a large amount */
void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */
void (*instr_hook_callback)(void); /* Called every instruction cycle prior to execution */
so, what happens if you load the savestate on a different pc, or at a different time of the day when the operating system decides to load the code into a different segment? problems.
I'm going to experiment with ignoring these pointers when loading a state, since they should already be set up in drvinit().etc. and see what happens...
EDIT: a little while later...
Success!!
I modified the 68k interface to preserve the pointers, save or load the cpu context data, then put the pointers back.
To make sure I wasn't seeing things, I disabled the new code in the 68k interface and tried loading a savestate between a fast-optimized FBA exe and a regular-optimized exe, and.. it exhibited the same symptoms as talked about a message or 2 back. (so thats good! it proves that the new code does indeed work.)
This new fix should help with the portablilty of savestates between 64 and 32bit systems also.
So what did we learn today? Savestate-scanning structures with pointers in them is bad, mm'kay!