--- previous/src/cpu/cpummu030.c 2018/04/24 19:30:13 1.1.1.2 +++ previous/src/cpu/cpummu030.c 2018/04/24 19:33:38 1.1.1.4 @@ -31,11 +31,14 @@ #include "sysconfig.h" #include "sysdeps.h" +#include "main.h" +#include "hatari-glue.h" +#include "host.h" + #include "options_cpu.h" #include "memory.h" #include "newcpu.h" #include "cpummu030.h" -#include "hatari-glue.h" #define MMU030_OP_DBG_MSG 0 #define MMU030_ATC_DBG_MSG 0 @@ -61,6 +64,10 @@ uae_u32 mm030_stageb_address; bool mmu030_retry; int mmu030_opcode; int mmu030_opcode_stageb; + +int mmu030_fake_prefetch; +uaecptr mmu030_fake_prefetch_addr; + uae_u16 mmu030_state[3]; uae_u32 mmu030_data_buffer; uae_u32 mmu030_disp_store[2]; @@ -97,7 +104,7 @@ typedef struct { /* MMU struct for 68030 */ -struct { +static struct { /* Translation tables */ struct { @@ -176,11 +183,32 @@ struct { /* -- MMU instructions -- */ -void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +static bool mmu_op30_invea(uae_u32 opcode) +{ + int eamode = (opcode >> 3) & 7; + int rreg = opcode & 7; + + // Dn, An, (An)+, -(An), immediate and PC-relative not allowed + if (eamode == 0 || eamode == 1 || eamode == 3 || eamode == 4 || eamode == 6 || (eamode == 7 && rreg > 1)) + return true; + return false; +} + +bool mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { int preg = (next >> 10) & 31; int rw = (next >> 9) & 1; int fd = (next >> 8) & 1; + int unused = (next & 0xff); + + if (mmu_op30_invea(opcode)) + return true; + // unused low 8 bits must be zeroed + if (unused) + return true; + // read and fd set? + if (rw && fd) + return true; #if MMU030_OP_DBG_MSG switch (preg) { @@ -225,7 +253,8 @@ void mmu_op30_pmove (uaecptr pc, uae_u32 x_put_long (extra, tc_030); else { tc_030 = x_get_long (extra); - mmu030_decode_tc(tc_030); + if (mmu030_decode_tc(tc_030)) + return true; } break; case 0x12: // SRP @@ -235,7 +264,9 @@ void mmu_op30_pmove (uaecptr pc, uae_u32 } else { srp_030 = (uae_u64)x_get_long (extra) << 32; srp_030 |= x_get_long (extra + 4); - mmu030_decode_rp(srp_030); + host_darkmatter(srp_030 == crp_030); + if (mmu030_decode_rp(srp_030)) + return true; } break; case 0x13: // CRP @@ -245,10 +276,15 @@ void mmu_op30_pmove (uaecptr pc, uae_u32 } else { crp_030 = (uae_u64)x_get_long (extra) << 32; crp_030 |= x_get_long (extra + 4); - mmu030_decode_rp(crp_030); + if (mmu030_decode_rp(crp_030)) + return true; } break; case 0x18: // MMUSR + if (fd) { + // FD must be always zero when MMUSR read or write + return true; + } if (rw) x_put_word (extra, mmusr_030); else @@ -272,17 +308,17 @@ void mmu_op30_pmove (uaecptr pc, uae_u32 break; default: write_log (_T("Bad PMOVE at %08x\n"),m68k_getpc()); - op_illg (opcode); - return; + return true; } - if (!fd && !rw && !(preg==0x18)) { + if (!fd && !rw && preg != 0x18) { mmu030_flush_atc_all(); } tt_enabled = (tt0_030 & TT_ENABLE) || (tt1_030 & TT_ENABLE); + return false; } -void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +bool mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { mmu030.status = mmusr_030 = 0; @@ -296,15 +332,12 @@ void mmu_op30_ptest (uaecptr pc, uae_u32 uae_u32 ret = 0; - /* Check this - datasheet says: - * "When the instruction specifies an address translation cache search - * with an address register operand, the MC68030 takes an F-line - * unimplemented instruction exception." - */ - if (!level && a) { /* correct ? */ + if (mmu_op30_invea(opcode)) + return true; + + if (!level && a) { write_log(_T("PTEST: Bad instruction causing F-line unimplemented instruction exception!\n")); - Exception(11); /* F-line unimplemented instruction exception */ - return; + return true; } #if MMU030_OP_DBG_MSG @@ -334,28 +367,36 @@ void mmu_op30_ptest (uaecptr pc, uae_u32 (mmusr_030&MMUSR_INVALID)?1:0, (mmusr_030&MMUSR_MODIFIED)?1:0, (mmusr_030&MMUSR_TRANSP_ACCESS)?1:0, mmusr_030&MMUSR_NUM_LEVELS_MASK); #endif + return false; } -void mmu_op30_pload (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +bool mmu_op30_pload (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { int rw = (next >> 9) & 1; + int unused = (next & (0x100 | 0x80 | 0x40 | 0x20)); uae_u32 fc = mmu_op30_helper_get_fc(next); - bool write = rw ? false : true; - + + if (mmu_op30_invea(opcode)) + return true; + if (unused) + return true; + #if 0 write_log (_T("PLOAD%c: Create ATC entry for %08X, FC = %i\n"), write?'W':'R', extra, fc); #endif mmu030_flush_atc_page(extra); mmu030_table_search(extra, fc, write, 0); + return false; } -void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +bool mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { - uae_u16 mode = (next&0x1C00)>>10; - uae_u32 fc_mask = (uae_u32)(next&0x00E0)>>5; + uae_u16 mode = (next >> 10) & 0x7; + uae_u32 fc_mask = (next >> 5) & 0x7; uae_u32 fc_base = mmu_op30_helper_get_fc(next); + uae_u32 fc_bits = next & 0x1f; #if 0 switch (mode) { @@ -378,19 +419,24 @@ void mmu_op30_pflush (uaecptr pc, uae_u3 switch (mode) { case 0x1: + if (fc_bits) + return true; mmu030_flush_atc_all(); break; case 0x4: mmu030_flush_atc_fc(fc_base, fc_mask); break; case 0x6: + if (mmu_op30_invea(opcode)) + return true; mmu030_flush_atc_page_fc(extra, fc_base, fc_mask); break; default: write_log(_T("PFLUSH ERROR: bad mode! (%i)\n"),mode); - break; + return true; } + return false; } /* -- Helper function for MMU instructions -- */ @@ -634,7 +680,7 @@ int mmu030_do_match_ttr(uae_u32 tt, TT_i int mmu030_do_match_lrmw_ttr(uae_u32 tt, TT_info comp, uaecptr addr, uae_u32 fc) { - if (tt & TT_ENABLE) { /* transparent translation enabled */ + if ((tt & TT_ENABLE) && (tt & TT_RWM)) { /* transparent translation enabled */ /* Compare actual function code with function code base using mask */ if ((comp.fc_base&comp.fc_mask)==(fc&comp.fc_mask)) { @@ -642,9 +688,7 @@ int mmu030_do_match_lrmw_ttr(uae_u32 tt, /* Compare actual address with address base using mask */ if ((comp.addr_base&comp.addr_mask)==(addr&comp.addr_mask)) { - if (tt&TT_RWM) { /* r/w field disabled */ - return TT_OK_MATCH; - } + return TT_OK_MATCH; } } } @@ -705,17 +749,43 @@ int mmu030_do_match_lrmw_ttr(uae_u32 tt, #define TC_TIC_MASK 0x000000F0 #define TC_TID_MASK 0x0000000F +static void mmu030_do_fake_prefetch(void) +{ + // fetch next opcode before MMU state switches. + // There are programs that do following: + // - enable MMU + // - JMP (An) + // "enable MMU" unmaps memory under us. + TRY (prb) { + uaecptr pc = m68k_getpci(); + mmu030_fake_prefetch = -1; + mmu030_fake_prefetch_addr = mmu030_translate(pc, regs.s != 0, false, false); + mmu030_fake_prefetch = x_prefetch(0); + // A26x0 ROM code switches off rom + // NOP + // JMP (a0) + if (mmu030_fake_prefetch == 0x4e71) + mmu030_fake_prefetch = x_prefetch(2); + } CATCH (prb) { + // didn't work, oh well.. + mmu030_fake_prefetch = -1; + } ENDTRY +} -void mmu030_decode_tc(uae_u32 TC) { - +bool mmu030_decode_tc(uae_u32 TC) +{ /* Set MMU condition */ if (TC & TC_ENABLE_TRANSLATION) { + if (!mmu030.enabled) + mmu030_do_fake_prefetch(); mmu030.enabled = true; } else { - if (mmu030.enabled) - write_log(_T("MMU disabled\n")); + if (mmu030.enabled) { + mmu030_do_fake_prefetch(); + write_log(_T("MMU disabled PC=%08x\n"), M68K_GETPC); + } mmu030.enabled = false; - return; + return false; } /* Note: 0 = Table A, 1 = Table B, 2 = Table C, 3 = Table D */ @@ -735,13 +805,13 @@ void mmu030_decode_tc(uae_u32 TC) { regs.mmu_page_size = 1 << mmu030.translation.page.size; - write_log(_T("68030 MMU enabled. Page size = %d\n"), regs.mmu_page_size); + write_log(_T("68030 MMU enabled. Page size = %d PC=%08x\n"), regs.mmu_page_size, M68K_GETPC); if (mmu030.translation.page.size<8) { write_log(_T("MMU Configuration Exception: Bad value in TC register! (bad page size: %i byte)\n"), 1<> 32; if (!descriptor_type) { /* If descriptor type is invalid */ write_log(_T("MMU Configuration Exception: Root Pointer is invalid!\n")); Exception(56); /* MMU Configuration Exception */ + return true; } + return false; #if MMU030_REG_DBG_MSG /* enable or disable debugging output */ uae_u32 table_limit = (RP & RP_LIMIT_MASK) >> 48; @@ -1195,8 +1268,8 @@ uae_u32 mmu030_table_search(uaecptr addr /* Update status bits */ mmu030.status |= super_violation ? MMUSR_SUPER_VIOLATION : 0; - mmu030.status |= write_protected ? MMUSR_WRITE_PROTECTED : 0; - + mmu030.status |= write_protected ? MMUSR_WRITE_PROTECTED : 0; + /* Check if ptest level is reached */ if (level && (level==descr_num)) { goto stop_search; @@ -1348,7 +1421,7 @@ uae_u32 mmu030_table_search(uaecptr addr /* update status bits */ mmu030.status |= super_violation ? MMUSR_SUPER_VIOLATION : 0; mmu030.status |= write_protected ? MMUSR_WRITE_PROTECTED : 0; - + /* check if caching is inhibited */ cache_inhibit = descr[0]&DESCR_CI ? true : false; @@ -1414,7 +1487,7 @@ uae_u32 mmu030_table_search(uaecptr addr write_log(_T("MMU: Bus error while %s descriptor!\n"), bBusErrorReadWrite?_T("reading"):_T("writing")); } ENDTRY - + /* check if we have to handle ptest */ if (level) { /* Note: wp, m and sv bits are undefined if the invalid bit is set */ @@ -1463,7 +1536,7 @@ uae_u32 mmu030_table_search(uaecptr addr mmu030.atc[i].physical.cache_inhibit = cache_inhibit; mmu030.atc[i].physical.modified = (mmu030.status&MMUSR_MODIFIED) ? true : false; mmu030.atc[i].physical.write_protect = (mmu030.status&MMUSR_WRITE_PROTECTED) ? true : false; - + #if MMU030_ATC_DBG_MSG write_log(_T("ATC create entry(%i): logical = %08X, physical = %08X, FC = %i\n"), i, mmu030.atc[i].logical.addr, mmu030.atc[i].physical.addr, @@ -1664,6 +1737,25 @@ uae_u32 mmu030_get_long_atc(uaecptr addr return phys_get_long(physical_addr); } +static uae_u32 mmu030_get_ilong_atc(uaecptr addr, int l, uae_u32 fc) { + uae_u32 page_index = addr & mmu030.translation.page.mask; + uae_u32 addr_mask = mmu030.translation.page.imask; + + uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask; +#if MMU030_ATC_DBG_MSG + write_log(_T("ATC match(%i): page addr = %08X, index = %08X (lget %08X)\n"), l, + physical_addr, page_index, phys_get_long(physical_addr + page_index)); +#endif + physical_addr += page_index; + + if (mmu030.atc[l].physical.bus_error) { + mmu030_page_fault(addr, true, MMU030_SSW_SIZE_L, fc); + return 0; + } + + return phys_get_long(physical_addr); +} + uae_u16 mmu030_get_word_atc(uaecptr addr, int l, uae_u32 fc) { uae_u32 page_index = addr & mmu030.translation.page.mask; uae_u32 addr_mask = mmu030.translation.page.imask; @@ -1683,6 +1775,25 @@ uae_u16 mmu030_get_word_atc(uaecptr addr return phys_get_word(physical_addr); } +static uae_u16 mmu030_get_iword_atc(uaecptr addr, int l, uae_u32 fc) { + uae_u32 page_index = addr & mmu030.translation.page.mask; + uae_u32 addr_mask = mmu030.translation.page.imask; + + uae_u32 physical_addr = mmu030.atc[l].physical.addr&addr_mask; +#if MMU030_ATC_DBG_MSG + write_log(_T("ATC match(%i): page addr = %08X, index = %08X (wget %04X)\n"), l, + physical_addr, page_index, phys_get_word(physical_addr + page_index)); +#endif + physical_addr += page_index; + + if (mmu030.atc[l].physical.bus_error) { + mmu030_page_fault(addr, true, MMU030_SSW_SIZE_W, fc); + return 0; + } + + return phys_get_word(physical_addr); +} + uae_u8 mmu030_get_byte_atc(uaecptr addr, int l, uae_u32 fc) { uae_u32 page_index = addr & mmu030.translation.page.mask; uae_u32 addr_mask = mmu030.translation.page.imask; @@ -1758,7 +1869,7 @@ int mmu030_logical_is_in_atc(uaecptr add uae_u32 addr_mask = mmu030.translation.page.imask; uae_u32 maddr = addr & addr_mask; int offset = (maddr >> mmu030.translation.page.size) & 0x1f; - + int i, index; index = atcindextable[offset]; for (i=0; i= ATC030_NUM_ENTRIES) @@ -1816,10 +1927,10 @@ void mmu030_atc_handle_history_bit(int e void mmu030_put_long(uaecptr addr, uae_u32 val, uae_u32 fc) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr,fc,true)) || (fc==7)) { - phys_put_long(addr,val); - return; + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,true)) || (!mmu030.enabled)) { + phys_put_long(addr,val); + return; } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true); @@ -1834,10 +1945,10 @@ void mmu030_put_long(uaecptr addr, uae_u void mmu030_put_word(uaecptr addr, uae_u16 val, uae_u32 fc) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr,fc,true)) || (fc==7)) { - phys_put_word(addr,val); - return; + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,true)) || (!mmu030.enabled)) { + phys_put_word(addr,val); + return; } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true); @@ -1852,10 +1963,10 @@ void mmu030_put_word(uaecptr addr, uae_u void mmu030_put_byte(uaecptr addr, uae_u8 val, uae_u32 fc) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr, fc, true)) || (fc==7)) { - phys_put_byte(addr,val); - return; + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,true)) || (!mmu030.enabled)) { + phys_put_byte(addr,val); + return; } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true); @@ -1868,11 +1979,28 @@ void mmu030_put_byte(uaecptr addr, uae_u } } +uae_u32 mmu030_get_ilong(uaecptr addr, uae_u32 fc) { + + // addr,fc,write + if ((fc == 7) || (mmu030_match_ttr_access(addr,fc,false)) || (!mmu030.enabled)) { + return phys_get_long(addr); + } + + int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false); + + if (atc_line_num >= 0) { + return mmu030_get_ilong_atc(addr, atc_line_num, fc); + } + else { + mmu030_table_search(addr, fc, false, 0); + return mmu030_get_ilong_atc(addr, mmu030_logical_is_in_atc(addr, fc, false), fc); + } +} uae_u32 mmu030_get_long(uaecptr addr, uae_u32 fc) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr,fc,false)) || (fc==7)) { - return phys_get_long(addr); + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,false)) || (!mmu030.enabled)) { + return phys_get_long(addr); } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false); @@ -1885,11 +2013,27 @@ uae_u32 mmu030_get_long(uaecptr addr, ua } } +uae_u16 mmu030_get_iword(uaecptr addr, uae_u32 fc) { + + // addr,fc,write + if ((fc == 7) || (mmu030_match_ttr_access(addr,fc,false)) || (!mmu030.enabled)) { + return phys_get_word(addr); + } + + int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false); + + if (atc_line_num >= 0) { + return mmu030_get_iword_atc(addr, atc_line_num, fc); + } else { + mmu030_table_search(addr, fc, false, 0); + return mmu030_get_iword_atc(addr, mmu030_logical_is_in_atc(addr, fc, false), fc); + } +} uae_u16 mmu030_get_word(uaecptr addr, uae_u32 fc) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr,fc,false)) || (fc==7)) { - return phys_get_word(addr); + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,false)) || (!mmu030.enabled)) { + return phys_get_word(addr); } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false); @@ -1904,9 +2048,9 @@ uae_u16 mmu030_get_word(uaecptr addr, ua uae_u8 mmu030_get_byte(uaecptr addr, uae_u32 fc) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr,fc,false)) || (fc==7)) { - return phys_get_byte(addr); + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,false)) || (!mmu030.enabled)) { + return phys_get_byte(addr); } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false); @@ -1923,15 +2067,15 @@ uae_u8 mmu030_get_byte(uaecptr addr, uae /* Not commonly used access function */ void mmu030_put_generic(uaecptr addr, uae_u32 val, uae_u32 fc, int size, int accesssize, int flags) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr, fc, true)) || (fc==7)) { - if (size == sz_byte) - phys_put_byte(addr, val); - else if (size == sz_word) - phys_put_word(addr, val); - else - phys_put_long(addr, val); - return; + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,true)) || (!mmu030.enabled)) { + if (size == sz_byte) + phys_put_byte(addr, val); + else if (size == sz_word) + phys_put_word(addr, val); + else + phys_put_long(addr, val); + return; } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true); @@ -1949,13 +2093,13 @@ void mmu030_put_generic(uaecptr addr, ua } static uae_u32 mmu030_get_generic_lrmw(uaecptr addr, uae_u32 fc, int size, int accesssize, int flags) { - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_lrmw_ttr_access(addr,fc)) || (fc==7)) { - if (size == sz_byte) - return phys_get_byte(addr); - else if (size == sz_word) - return phys_get_word(addr); - return phys_get_long(addr); + // addr,fc,write + if ((fc==7) || (mmu030_match_lrmw_ttr_access(addr,fc)) || (!mmu030.enabled)) { + if (size == sz_byte) + return phys_get_byte(addr); + else if (size == sz_word) + return phys_get_word(addr); + return phys_get_long(addr); } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, true); @@ -1972,16 +2116,16 @@ static uae_u32 mmu030_get_generic_lrmw(u } } uae_u32 mmu030_get_generic(uaecptr addr, uae_u32 fc, int size, int accesssize, int flags) { - if (flags & MMU030_SSW_RM) { - return mmu030_get_generic_lrmw(addr, fc, size, accesssize, flags); - } - // addr,super,write - if ((!mmu030.enabled) || (mmu030_match_ttr_access(addr,fc,false)) || (fc==7)) { - if (size == sz_byte) - return phys_get_byte(addr); - else if (size == sz_word) - return phys_get_word(addr); - return phys_get_long(addr); + if (flags & MMU030_SSW_RM) { + return mmu030_get_generic_lrmw(addr, fc, size, accesssize, flags); + } + // addr,fc,write + if ((fc==7) || (mmu030_match_ttr_access(addr,fc,false)) || (!mmu030.enabled)) { + if (size == sz_byte) + return phys_get_byte(addr); + else if (size == sz_word) + return phys_get_word(addr); + return phys_get_long(addr); } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, false); @@ -2051,6 +2195,23 @@ uae_u16 REGPARAM2 mmu030_get_word_unalig return res; } +uae_u32 REGPARAM2 mmu030_get_ilong_unaligned(uaecptr addr, uae_u32 fc, int flags) +{ + uae_u32 res; + + res = (uae_u32)mmu030_get_iword(addr, fc) << 16; + SAVE_EXCEPTION; + TRY(prb) { + res |= mmu030_get_iword(addr + 2, fc); + RESTORE_EXCEPTION; + } + CATCH(prb) { + RESTORE_EXCEPTION; + THROW_AGAIN(prb); + } ENDTRY + return res; +} + uae_u32 REGPARAM2 mmu030_get_long_unaligned(uaecptr addr, uae_u32 fc, int flags) { uae_u32 res; @@ -2139,9 +2300,9 @@ static uaecptr mmu030_get_addr_atc(uaecp } uaecptr mmu030_translate(uaecptr addr, bool super, bool data, bool write) { - int fc = (super ? 4 : 0) | (data ? 1 : 2); - if ((!mmu030.enabled) || (mmu030_match_ttr(addr,fc,write)&TT_OK_MATCH) || (fc==7)) { - return addr; + int fc = (super ? 4 : 0) | (data ? 1 : 2); + if ((fc==7) || (mmu030_match_ttr(addr,fc,write)&TT_OK_MATCH) || (!mmu030.enabled)) { + return addr; } int atc_line_num = mmu030_logical_is_in_atc(addr, fc, write); @@ -2168,6 +2329,13 @@ void mmu030_reset(int hardreset) mmusr_030 = 0; mmu030_flush_atc_all(); } + mmu030_set_funcs(); +} + +void mmu030_set_funcs(void) +{ + if (currprefs.mmu_model != 68030) + return; } @@ -2178,14 +2346,14 @@ void m68k_do_rte_mmu030 (uaecptr a7) uae_u16 format = get_word_mmu030 (a7 + 6); uae_u16 frame = format >> 12; uae_u16 ssw = get_word_mmu030 (a7 + 10); - - // Fetch last word, real CPU does it to allow OS bus handler to map - // the page if frame crosses pages and following page is not resident. - if (frame == 0xb) - get_word_mmu030(a7 + 92 - 2); - else - get_word_mmu030(a7 + 32 - 2); - + + // Fetch last word, real CPU does it to allow OS bus handler to map + // the page if frame crosses pages and following page is not resident. + if (frame == 0xb) + get_word_mmu030(a7 + 92 - 2); + else + get_word_mmu030(a7 + 32 - 2); + // Internal register, our opcode storage area mmu030_opcode = get_long_mmu030 (a7 + 0x14); // Misc state data @@ -2194,16 +2362,17 @@ void m68k_do_rte_mmu030 (uaecptr a7) mmu030_state[2] = get_word_mmu030 (a7 + 0x34); mmu030_disp_store[0] = get_long_mmu030 (a7 + 0x1c); mmu030_disp_store[1] = get_long_mmu030 (a7 + 0x1c + 4); - if (mmu030_state[1] & MMU030_STATEFLAG1_FMOVEM) { - mmu030_fmovem_store[0] = get_long_mmu030 (a7 + 0x5c - (7 + 1) * 4); - mmu030_fmovem_store[1] = get_long_mmu030 (a7 + 0x5c - (8 + 1) * 4); - } + if (mmu030_state[1] & MMU030_STATEFLAG1_FMOVEM) { + mmu030_fmovem_store[0] = get_long_mmu030 (a7 + 0x5c - (7 + 1) * 4); + mmu030_fmovem_store[1] = get_long_mmu030 (a7 + 0x5c - (8 + 1) * 4); + } // Rerun "mmu030_opcode" using restored state. mmu030_retry = true; if (frame == 0xb) { uae_u16 idxsize = get_word_mmu030 (a7 + 0x36); - for (int i = 0; i < idxsize + 1; i++) { + int i; + for (i = 0; i < idxsize + 1; i++) { mmu030_ad[i].done = i < idxsize; mmu030_ad[i].val = get_long_mmu030 (a7 + 0x5c - (i + 1) * 4); }