[Core/CPU] removed 68k stack access optimizations to prevent unintentional (or intentional) ROM corruption

This commit is contained in:
EkeEke 2017-05-08 16:35:05 +02:00
parent 9810f9d34b
commit ee0fd881f6

View File

@ -1049,36 +1049,30 @@ INLINE uint OPER_PCIX_32(void) {uint ea = EA_PCIX_32(); return m68ki_read_pcre
/* ---------------------------- Stack Functions --------------------------- */ /* ---------------------------- Stack Functions --------------------------- */
/* Push/pull data from the stack */ /* Push/pull data from the stack */
/* Optimized access assuming stack is always located in ROM/RAM [EkeEke] */
INLINE void m68ki_push_16(uint value) INLINE void m68ki_push_16(uint value)
{ {
REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2); REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2);
/*m68ki_write_16(REG_SP, value);*/ m68ki_write_16(REG_SP, value);
*(uint16 *)(m68ki_cpu.memory_map[(REG_SP>>16)&0xff].base + (REG_SP & 0xffff)) = value;
} }
INLINE void m68ki_push_32(uint value) INLINE void m68ki_push_32(uint value)
{ {
REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4); REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4);
/*m68ki_write_32(REG_SP, value);*/ m68ki_write_32(REG_SP, value);
*(uint16 *)(m68ki_cpu.memory_map[(REG_SP>>16)&0xff].base + (REG_SP & 0xffff)) = value >> 16;
*(uint16 *)(m68ki_cpu.memory_map[((REG_SP + 2)>>16)&0xff].base + ((REG_SP + 2) & 0xffff)) = value & 0xffff;
} }
INLINE uint m68ki_pull_16(void) INLINE uint m68ki_pull_16(void)
{ {
uint sp = REG_SP; uint sp = REG_SP;
REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2); REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2);
return m68k_read_immediate_16(sp); return m68ki_read_16(sp);
/*return m68ki_read_16(sp);*/
} }
INLINE uint m68ki_pull_32(void) INLINE uint m68ki_pull_32(void)
{ {
uint sp = REG_SP; uint sp = REG_SP;
REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4); REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4);
return m68k_read_immediate_32(sp); return m68ki_read_32(sp);
/*return m68ki_read_32(sp);*/
} }