From 2531e60e211a89f7740ccb82f8a12eea99f49a47 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 29 Nov 2018 19:15:34 +0200 Subject: [PATCH] 68030 MMU fix: do not assume DOB is not modified by exception handler when DF is not cleared. --- cpummu30.cpp | 11 +++++++---- newcpu.cpp | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cpummu30.cpp b/cpummu30.cpp index 45729d08..88375bf6 100644 --- a/cpummu30.cpp +++ b/cpummu30.cpp @@ -2712,7 +2712,7 @@ void m68k_do_rte_mmu030 (uaecptr a7) // Internal register, our opcode storage area uae_u32 oc = get_long_mmu030(a7 + 0x14); - // Movem write data + // Data output buffer uae_u32 mmu030_data_buffer_out_v = get_long_mmu030(a7 + 0x18); // get_disp_ea_020 uae_u32 mmu030_disp_store_0 = get_long_mmu030(a7 + 0x1c); @@ -2831,8 +2831,9 @@ void m68k_do_rte_mmu030 (uaecptr a7) #endif #if 0 - write_log(_T("%08x %08x %08x %08x %08x %d %d %d "), mmu030_state[1], mmu030_state[2], mmu030_disp_store[0], mmu030_disp_store[1], addr, read, size, fc); - dump_opcode(mmu030_opcode); + write_log(_T("%08x %08x %08x %08x %08x %d %d %d %08x %08x\n"), + mmu030_state[1], mmu030_state[2], mmu030_disp_store[0], mmu030_disp_store[1], + addr, read, size, fc, mmu030_data_buffer_out, mmu030_ad[idxsize].val); #endif if (read) { @@ -2859,6 +2860,8 @@ void m68k_do_rte_mmu030 (uaecptr a7) mmu030_ad[idxsize].done = true; } } else { + // NeXTstep 1.0a modifies DOB and it must be ignored. + mmu030_data_buffer_out = mmu030_ad[mmu030_idx].val; if (mmu030_state[1] & MMU030_STATEFLAG1_SUBACCESS0) { mmu030_unaligned_write_continue(addr, fc, mmu030_put_generic); } else { @@ -3099,7 +3102,7 @@ void m68k_do_rte_mmu030c (uaecptr a7) // Internal register, our opcode storage area uae_u32 oc = get_long_mmu030c(a7 + 0x14); - // Movem write data + // Data output buffer uae_u32 mmu030_data_buffer_out_v = get_long_mmu030c(a7 + 0x18); // get_disp_ea_020 uae_u32 mmu030_disp_store_0 = get_long_mmu030c(a7 + 0x1c); diff --git a/newcpu.cpp b/newcpu.cpp index 8070bb87..eaf53d85 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -3203,6 +3203,10 @@ static void Exception_build_stack_frame (uae_u32 oldpc, uae_u32 currpc, uae_u32 write_log(_T("mmu030_idx out of bounds! %d >= %d\n"), mmu030_idx, MAX_MMU030_ACCESS); } #endif + if (!(ssw & MMU030_SSW_RW)) { + // NeXTstep 1.0a modifies DOB so store value in storage too. + mmu030_ad[mmu030_idx].val = mmu030_data_buffer_out; + } for (i = 0; i < mmu030_idx + 1; i++) { m68k_areg (regs, 7) -= 4; x_put_long (m68k_areg (regs, 7), mmu030_ad[i].val); -- 2.47.3