{
uae_u32 log;
uae_u32 phys;
+ uae_u8 cs;
};
static struct mmufastcache030 atc_data_cache_read[MMUFASTCACHE_ENTRIES030];
static struct mmufastcache030 atc_data_cache_write[MMUFASTCACHE_ENTRIES030];
if (idx2 < MMUFASTCACHE_ENTRIES030 - 1) {
atc_data_cache_read[idx2].log = idx1;
atc_data_cache_read[idx2].phys = phys;
+ atc_data_cache_read[idx2].cs = mmu030_cache_state;
}
#endif
}
if (idx2 < MMUFASTCACHE_ENTRIES030 - 1) {
atc_data_cache_write[idx2].log = idx1;
atc_data_cache_write[idx2].phys = phys;
+ atc_data_cache_write[idx2].cs = mmu030_cache_state;
}
#endif
}
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES030 - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu030.translation.page.mask);
+ mmu030_cache_state = atc_data_cache_write[idx2].cs;
} else
#endif
{
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES030 - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu030.translation.page.mask);
+ mmu030_cache_state = atc_data_cache_write[idx2].cs;
} else
#endif
{
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES030 - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu030.translation.page.mask);
+ mmu030_cache_state = atc_data_cache_write[idx2].cs;
} else
#endif
{
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES030 - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu030.translation.page.mask);
+ mmu030_cache_state = atc_data_cache_read[idx2].cs;
} else
#endif
{
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES030 - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu030.translation.page.mask);
+ mmu030_cache_state = atc_data_cache_read[idx2].cs;
} else
#endif
{
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES030 - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu030.translation.page.mask);
+ mmu030_cache_state = atc_data_cache_read[idx2].cs;
} else
#endif
{
printf ("\tuaecptr pc = %s;\n", getpc);
if (using_indirect > 0 && !using_ce020 && !using_prefetch_020 && !using_ce) {
printf("\tm68k_do_rtsi_jit ();\n");
+ } else if (using_mmu) {
+ printf ("\tm68k_do_rts_mmu%s ();\n", mmu_postfix);
} else if (using_ce020 == 1) {
add_head_cycs (1);
printf ("\tm68k_do_rts_ce020 ();\n");
printf ("\tm68k_do_rts_ce030 ();\n");
} else if (using_ce) {
printf ("\tm68k_do_rts_ce ();\n");
- } else if (using_mmu) {
- printf ("\tm68k_do_rts_mmu%s ();\n", mmu_postfix);
} else if (using_prefetch || using_prefetch_020) {
printf ("\tm68k_do_rtsi ();\n");
} else {
addcycles000 (2);
if (using_indirect > 0 && !using_ce020 && !using_prefetch_020 && !using_ce) {
printf("\tm68k_do_bsri_jit (%s + %d, s);\n", getpc, m68k_pc_offset);
+ } else if (using_mmu) {
+ printf ("\tm68k_do_bsr_mmu%s (%s + %d, s);\n", mmu_postfix, getpc, m68k_pc_offset);
} else if (using_ce020 == 1) {
printf ("\tm68k_do_bsr_ce020 (%s + %d, s);\n", getpc, m68k_pc_offset);
} else if (using_ce020 == 2) {
printf ("\tm68k_do_bsr_ce030 (%s + %d, s);\n", getpc, m68k_pc_offset);
} else if (using_ce) {
printf ("\tm68k_do_bsr_ce (%s + %d, s);\n", getpc, m68k_pc_offset);
- } else if (using_mmu) {
- printf ("\tm68k_do_bsr_mmu%s (%s + %d, s);\n", mmu_postfix, getpc, m68k_pc_offset);
} else if (using_prefetch || using_prefetch_020) {
printf ("\tm68k_do_bsri (%s + %d, s);\n", getpc, m68k_pc_offset);
} else {
extern uae_u32 get_word_ce030_prefetch(int);
extern uae_u32 get_word_ce030_prefetch_opcode(int);
+STATIC_INLINE uae_u32 get_long_ce030 (uaecptr addr)
+{
+ return mem_access_delay_long_read_ce020 (addr);
+}
+STATIC_INLINE uae_u32 get_word_ce030 (uaecptr addr)
+{
+ return mem_access_delay_word_read_ce020 (addr);
+}
+STATIC_INLINE uae_u32 get_byte_ce030 (uaecptr addr)
+{
+ return mem_access_delay_byte_read_ce020 (addr);
+}
+
STATIC_INLINE void put_long_ce030 (uaecptr addr, uae_u32 v)
{
- write_dcache030_lput(addr, v, (regs.s ? 4 : 0) | 1);
+ mem_access_delay_long_write_ce020 (addr, v);
}
STATIC_INLINE void put_word_ce030 (uaecptr addr, uae_u32 v)
{
- write_dcache030_wput(addr, v, (regs.s ? 4 : 0) | 1);
+ mem_access_delay_word_write_ce020 (addr, v);
}
STATIC_INLINE void put_byte_ce030 (uaecptr addr, uae_u32 v)
+{
+ mem_access_delay_byte_write_ce020 (addr, v);
+}
+
+
+STATIC_INLINE void put_long_dc030 (uaecptr addr, uae_u32 v)
+{
+ write_dcache030_lput(addr, v, (regs.s ? 4 : 0) | 1);
+}
+STATIC_INLINE void put_word_dc030 (uaecptr addr, uae_u32 v)
+{
+ write_dcache030_wput(addr, v, (regs.s ? 4 : 0) | 1);
+}
+STATIC_INLINE void put_byte_dc030 (uaecptr addr, uae_u32 v)
{
write_dcache030_bput(addr, v, (regs.s ? 4 : 0) | 1);
}
-STATIC_INLINE uae_u32 get_long_ce030 (uaecptr addr)
+STATIC_INLINE uae_u32 get_long_dc030 (uaecptr addr)
{
return read_dcache030_lget(addr, (regs.s ? 4 : 0) | 1);
}
-STATIC_INLINE uae_u32 get_word_ce030 (uaecptr addr)
+STATIC_INLINE uae_u32 get_word_dc030 (uaecptr addr)
{
return read_dcache030_wget(addr, (regs.s ? 4 : 0) | 1);
}
-STATIC_INLINE uae_u32 get_byte_ce030 (uaecptr addr)
+STATIC_INLINE uae_u32 get_byte_dc030 (uaecptr addr)
{
return read_dcache030_bget(addr, (regs.s ? 4 : 0) | 1);
}
STATIC_INLINE void m68k_do_bsr_ce030 (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
- put_long_ce030 (m68k_areg (regs, 7), oldpc);
+ x_put_long (m68k_areg (regs, 7), oldpc);
m68k_incpci (offset);
}
STATIC_INLINE void m68k_do_rts_ce030 (void)
{
- m68k_setpc (get_long_ce030 (m68k_areg (regs, 7)));
+ m68k_setpc (x_get_long (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4;
}
// non-cache
-
static ALWAYS_INLINE uae_u32 sfc030_get_long(uaecptr addr)
{
uae_u32 fc = regs.sfc;
extern void flush_mmu030 (uaecptr, int);
extern void m68k_do_bsr_mmu030 (uaecptr oldpc, uae_s32 offset);
-// cache
+// more compatible + optional cache
+
+static ALWAYS_INLINE uae_u32 mmu030_get_fc_byte(uaecptr addr, uae_u32 fc)
+{
+ return mmu030_get_byte(addr, fc);
+}
+static ALWAYS_INLINE uae_u32 mmu030_get_fc_word(uaecptr addr, uae_u32 fc)
+{
+ return mmu030_get_word(addr, fc);
+}
+static ALWAYS_INLINE uae_u32 mmu030_get_fc_long(uaecptr addr, uae_u32 fc)
+{
+ return mmu030_get_long(addr, fc);
+}
+static ALWAYS_INLINE void mmu030_put_fc_byte(uaecptr addr, uae_u32 val, uae_u32 fc)
+{
+ mmu030_put_byte(addr, val, fc);
+}
+static ALWAYS_INLINE void mmu030_put_fc_word(uaecptr addr, uae_u32 val, uae_u32 fc)
+{
+ mmu030_put_word(addr, val, fc);
+}
+static ALWAYS_INLINE void mmu030_put_fc_long(uaecptr addr, uae_u32 val, uae_u32 fc)
+{
+ mmu030_put_long(addr, val, fc);
+}
static ALWAYS_INLINE uae_u32 sfc030c_get_long(uaecptr addr)
{
#if MMUDEBUG > 2
write_log(_T("sfc030_get_long: FC = %i\n"),fc);
#endif
- return read_dcache030_lget(addr, regs.sfc);
+ return read_data_030_fc_lget(addr, regs.sfc);
}
static ALWAYS_INLINE uae_u16 sfc030c_get_word(uaecptr addr)
#if MMUDEBUG > 2
write_log(_T("sfc030_get_word: FC = %i\n"),fc);
#endif
- return read_dcache030_wget(addr, regs.sfc);
+ return read_data_030_fc_wget(addr, regs.sfc);
}
static ALWAYS_INLINE uae_u8 sfc030c_get_byte(uaecptr addr)
#if MMUDEBUG > 2
write_log(_T("sfc030_get_byte: FC = %i\n"),fc);
#endif
- return read_dcache030_bget(addr, regs.sfc);
+ return read_data_030_fc_bget(addr, regs.sfc);
}
static ALWAYS_INLINE void dfc030c_put_long(uaecptr addr, uae_u32 val)
#if MMUDEBUG > 2
write_log(_T("dfc030_put_long: %08X = %08X FC = %i\n"), addr, val, fc);
#endif
- write_dcache030_lput(addr, val, regs.dfc);
+ write_data_030_fc_lput(addr, val, regs.dfc);
}
static ALWAYS_INLINE void dfc030c_put_word(uaecptr addr, uae_u16 val)
#if MMUDEBUG > 2
write_log(_T("dfc030_put_word: %08X = %04X FC = %i\n"), addr, val, fc);
#endif
- write_dcache030_wput(addr, val, regs.dfc);
+ write_data_030_fc_wput(addr, val, regs.dfc);
}
static ALWAYS_INLINE void dfc030c_put_byte(uaecptr addr, uae_u8 val)
#if MMUDEBUG > 2
write_log(_T("dfc030_put_byte: %08X = %02X FC = %i\n"), addr, val, fc);
#endif
- write_dcache030_bput(addr, val, regs.dfc);
+ write_data_030_fc_bput(addr, val, regs.dfc);
}
uae_u32 REGPARAM3 get_disp_ea_020_mmu030c (uae_u32 base, int idx) REGPARAM;
extern void(*write_data_030_wput)(uaecptr,uae_u32);
extern void(*write_data_030_lput)(uaecptr,uae_u32);
+extern uae_u32(*read_data_030_fc_bget)(uaecptr, uae_u32);
+extern uae_u32(*read_data_030_fc_wget)(uaecptr, uae_u32);
+extern uae_u32(*read_data_030_fc_lget)(uaecptr, uae_u32);
+extern void(*write_data_030_fc_bput)(uaecptr, uae_u32, uae_u32);
+extern void(*write_data_030_fc_wput)(uaecptr, uae_u32, uae_u32);
+extern void(*write_data_030_fc_lput)(uaecptr, uae_u32, uae_u32);
+
extern void write_dcache030_bput(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_wput(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_lput(uaecptr, uae_u32, uae_u32);
uae_u32(*read_data_030_lget)(uaecptr);
void(*write_data_030_bput)(uaecptr,uae_u32);
void(*write_data_030_wput)(uaecptr,uae_u32);
- void(*write_data_030_lput)(uaecptr,uae_u32);
+void(*write_data_030_lput)(uaecptr,uae_u32);
-static void set_x_ifetches(void)
+uae_u32(*read_data_030_fc_bget)(uaecptr, uae_u32);
+uae_u32(*read_data_030_fc_wget)(uaecptr, uae_u32);
+uae_u32(*read_data_030_fc_lget)(uaecptr, uae_u32);
+void(*write_data_030_fc_bput)(uaecptr, uae_u32, uae_u32);
+void(*write_data_030_fc_wput)(uaecptr, uae_u32, uae_u32);
+void(*write_data_030_fc_lput)(uaecptr, uae_u32, uae_u32);
+
+
+ static void set_x_ifetches(void)
{
if (m68k_pc_indirect) {
if (currprefs.cachesize) {
x_get_ibyte = NULL;
x_next_iword = next_iword_mmu030c_state;
x_next_ilong = next_ilong_mmu030c_state;
- x_put_long = put_long_ce030;
- x_put_word = put_word_ce030;
- x_put_byte = put_byte_ce030;
- x_get_long = get_long_ce030;
- x_get_word = get_word_ce030;
- x_get_byte = get_byte_ce030;
x_do_cycles = do_cycles;
x_do_cycles_pre = do_cycles;
x_do_cycles_post = do_cycles_post;
x_get_ibyte = NULL;
x_next_iword = next_iword_mmu030c_state;
x_next_ilong = next_ilong_mmu030c_state;
- x_put_long = put_long_ce030;
- x_put_word = put_word_ce030;
- x_put_byte = put_byte_ce030;
- x_get_long = get_long_ce030;
- x_get_word = get_word_ce030;
- x_get_byte = get_byte_ce030;
x_do_cycles = do_cycles;
x_do_cycles_pre = do_cycles;
x_do_cycles_post = do_cycles_post;
x_get_ibyte = get_ibyte_mmu030;
x_next_iword = next_iword_mmu030;
x_next_ilong = next_ilong_mmu030;
- x_put_long = put_long_mmu030;
- x_put_word = put_word_mmu030;
- x_put_byte = put_byte_mmu030;
- x_get_long = get_long_mmu030;
- x_get_word = get_word_mmu030;
- x_get_byte = get_byte_mmu030;
+ }
+ x_put_long = put_long_mmu030;
+ x_put_word = put_word_mmu030;
+ x_put_byte = put_byte_mmu030;
+ x_get_long = get_long_mmu030;
+ x_get_word = get_word_mmu030;
+ x_get_byte = get_byte_mmu030;
+ if (currprefs.cpu_data_cache) {
+ x_put_long = put_long_dc030;
+ x_put_word = put_word_dc030;
+ x_put_byte = put_byte_dc030;
+ x_get_long = get_long_dc030;
+ x_get_word = get_word_dc030;
+ x_get_byte = get_byte_dc030;
}
}
x_get_ibyte = NULL;
x_next_iword = next_iword_030ce;
x_next_ilong = next_ilong_030ce;
- x_put_long = put_long_ce030;
- x_put_word = put_word_ce030;
- x_put_byte = put_byte_ce030;
- x_get_long = get_long_ce030;
- x_get_word = get_word_ce030;
- x_get_byte = get_byte_ce030;
+ if (currprefs.cpu_data_cache) {
+ x_put_long = put_long_dc030;
+ x_put_word = put_word_dc030;
+ x_put_byte = put_byte_dc030;
+ x_get_long = get_long_dc030;
+ x_get_word = get_word_dc030;
+ x_get_byte = get_byte_dc030;
+ } else {
+ x_put_long = put_long_ce030;
+ x_put_word = put_word_ce030;
+ x_put_byte = put_byte_ce030;
+ x_get_long = get_long_ce030;
+ x_get_word = get_word_ce030;
+ x_get_byte = get_byte_ce030;
+ }
x_do_cycles = do_cycles_ce020;
x_do_cycles_pre = do_cycles_ce020;
x_do_cycles_post = do_cycles_ce020_post;
write_data_030_bput = write_dcache030_mmu_bput;
write_data_030_wput = write_dcache030_mmu_wput;
write_data_030_lput = write_dcache030_mmu_lput;
+
+ read_data_030_fc_bget = read_dcache030_bget;
+ read_data_030_fc_wget = read_dcache030_wget;
+ read_data_030_fc_lget = read_dcache030_lget;
+ write_data_030_fc_bput = write_dcache030_bput;
+ write_data_030_fc_wput = write_dcache030_wput;
+ write_data_030_fc_lput = write_dcache030_lput;
} else {
read_data_030_bget = dcache_bget;
read_data_030_wget = dcache_wget;
write_data_030_bput = dcache_bput;
write_data_030_wput = dcache_wput;
write_data_030_lput = dcache_lput;
+
+ read_data_030_fc_bget = mmu030_get_fc_byte;
+ read_data_030_fc_wget = mmu030_get_fc_word;
+ read_data_030_fc_lget = mmu030_get_fc_long;
+ write_data_030_fc_bput = mmu030_put_fc_byte;
+ write_data_030_fc_wput = mmu030_put_fc_word;
+ write_data_030_fc_lput = mmu030_put_fc_long;
}
+
if (currprefs.mmu_model) {
if (currprefs.cpu_compatible) {
icache_fetch = uae_mmu030_get_ilong_fc;
- dcache_lput = uae_mmu030_put_long_fc;
- dcache_wput = uae_mmu030_put_word_fc;
- dcache_bput = uae_mmu030_put_byte_fc;
- dcache_lget = uae_mmu030_get_long_fc;
- dcache_wget = uae_mmu030_get_word_fc;
- dcache_bget = uae_mmu030_get_byte_fc;
- dcache_check = uae_mmu030_check_fc;
} else {
icache_fetch = uae_mmu030_get_ilong;
- dcache_lput = uae_mmu030_put_long;
- dcache_wput = uae_mmu030_put_word;
- dcache_bput = uae_mmu030_put_byte;
- dcache_lget = uae_mmu030_get_long;
- dcache_wget = uae_mmu030_get_word;
- dcache_bget = uae_mmu030_get_byte;
}
+ dcache_lput = uae_mmu030_put_long;
+ dcache_wput = uae_mmu030_put_word;
+ dcache_bput = uae_mmu030_put_byte;
+ dcache_lget = uae_mmu030_get_long;
+ dcache_wget = uae_mmu030_get_word;
+ dcache_bget = uae_mmu030_get_byte;
if (currprefs.cpu_data_cache) {
read_data_030_bget = read_dcache030_mmu_bget;
read_data_030_wget = read_dcache030_mmu_wget;
write_data_030_bput = write_dcache030_mmu_bput;
write_data_030_wput = write_dcache030_mmu_wput;
write_data_030_lput = write_dcache030_mmu_lput;
+ dcache_lput = uae_mmu030_put_long_fc;
+ dcache_wput = uae_mmu030_put_word_fc;
+ dcache_bput = uae_mmu030_put_byte_fc;
+ dcache_lget = uae_mmu030_get_long_fc;
+ dcache_wget = uae_mmu030_get_word_fc;
+ dcache_bget = uae_mmu030_get_byte_fc;
+ dcache_check = uae_mmu030_check_fc;
} else {
- if (currprefs.cpu_compatible) {
- read_data_030_bget = uae_mmu030_get_byte_fc;
- read_data_030_wget = uae_mmu030_get_word_fc;
- read_data_030_lget = uae_mmu030_get_long_fc;
- write_data_030_bput = uae_mmu030_put_byte_fc;
- write_data_030_wput = uae_mmu030_put_word_fc;
- write_data_030_lput = uae_mmu030_put_long_fc;
- } else {
- read_data_030_bget = uae_mmu030_get_byte;
- read_data_030_wget = uae_mmu030_get_word;
- read_data_030_lget = uae_mmu030_get_long;
- write_data_030_bput = uae_mmu030_put_byte;
- write_data_030_wput = uae_mmu030_put_word;
- write_data_030_lput = uae_mmu030_put_long;
- }
+ read_data_030_bget = uae_mmu030_get_byte;
+ read_data_030_wget = uae_mmu030_get_word;
+ read_data_030_lget = uae_mmu030_get_long;
+ write_data_030_bput = uae_mmu030_put_byte;
+ write_data_030_wput = uae_mmu030_put_word;
+ write_data_030_lput = uae_mmu030_put_long;
}
} else if (currprefs.cpu_memory_cycle_exact) {
icache_fetch = mem_access_delay_longi_read_ce020;
uae_u32 read_dcache030_lrmw_mmu(uaecptr addr, uae_u32 size)
{
- mmu030_cache_state = CACHE_DISABLE_MMU;
- if (size == 0)
- return read_dcache030_bget(addr, (regs.s ? 4 : 0) | 1);
- if (size == 1)
- return read_dcache030_wget(addr, (regs.s ? 4 : 0) | 1);
- return read_dcache030_lget(addr, (regs.s ? 4 : 0) | 1);
+ if (currprefs.cpu_data_cache) {
+ mmu030_cache_state = CACHE_DISABLE_MMU;
+ if (size == 0)
+ return read_dcache030_bget(addr, (regs.s ? 4 : 0) | 1);
+ if (size == 1)
+ return read_dcache030_wget(addr, (regs.s ? 4 : 0) | 1);
+ return read_dcache030_lget(addr, (regs.s ? 4 : 0) | 1);
+ } else {
+ if (size == 0)
+ return read_data_030_bget(addr);
+ if (size == 1)
+ return read_data_030_wget(addr);
+ return read_data_030_lget(addr);
+ }
}
void write_dcache030_lrmw_mmu(uaecptr addr, uae_u32 val, uae_u32 size)
{
- mmu030_cache_state = CACHE_DISABLE_MMU;
- if (size == 0)
- write_dcache030_bput(addr, val, (regs.s ? 4 : 0) | 1);
- else if (size == 1)
- write_dcache030_wput(addr, val, (regs.s ? 4 : 0) | 1);
- else
- write_dcache030_lput(addr, val, (regs.s ? 4 : 0) | 1);
+ if (currprefs.cpu_data_cache) {
+ mmu030_cache_state = CACHE_DISABLE_MMU;
+ if (size == 0)
+ write_dcache030_bput(addr, val, (regs.s ? 4 : 0) | 1);
+ else if (size == 1)
+ write_dcache030_wput(addr, val, (regs.s ? 4 : 0) | 1);
+ else
+ write_dcache030_lput(addr, val, (regs.s ? 4 : 0) | 1);
+ } else {
+ if (size == 0)
+ write_data_030_bput(addr, val);
+ else if (size == 1)
+ write_data_030_wput(addr, val);
+ else
+ write_data_030_lput(addr, val);
+ }
}
static void do_access_or_bus_error(uaecptr pc, uaecptr pcnow)