wince: attempt immediate read/write when address isn't translated

This commit is contained in:
flyinghead 2021-01-07 19:18:53 +01:00
parent 0b5c19f634
commit e5b3c5268b
4 changed files with 35 additions and 5 deletions

View File

@ -85,6 +85,36 @@ template<u32 translation_type, typename T>
extern u32 mmu_data_translation(u32 va, u32& rv);
void DoMMUException(u32 addr, u32 error_code, u32 access_type);
template<u32 translation_type>
bool mmu_is_translated(u32 va, u32 size)
{
if (va & (size - 1))
return true;
if (translation_type == MMU_TT_DWRITE)
{
if ((va & 0xFC000000) == 0xE0000000)
//SQ writes are not translated, only write backs are.
return false;
}
#ifndef sr
// This is why the preprocessor sucks
#define sr Sh4cntx.sr
#define undef_sr
#endif
if (sr.MD == 1 && (va & 0xFC000000) == 0x7C000000)
return false;
#ifdef undef_sr
#undef sr
#undef undef_sr
#endif
if (fast_reg_lut[va >> 29] != 0)
return false;
return true;
}
#if defined(NO_MMU)
bool inline mmu_TranslateSQW(u32 addr, u32* mapped) {
*mapped = sq_remap[(addr>>20)&0x3F] | (addr & 0xFFFE0);

View File

@ -50,7 +50,7 @@ static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
const char* fmt, ...)
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(__MINGW32__)
__attribute__((format(printf, 5, 6)))
#endif
;

View File

@ -1648,7 +1648,7 @@ private:
u32 size = op.flags & 0x7f;
u32 addr = op.rs1._imm;
if (mmu_enabled())
if (mmu_enabled() && mmu_is_translated<MMU_TT_DREAD>(addr, size))
{
if ((addr >> 12) != (block->vaddr >> 12))
// When full mmu is on, only consider addresses in the same 4k page
@ -1870,7 +1870,7 @@ private:
u32 size = op.flags & 0x7f;
u32 addr = op.rs1._imm;
if (mmu_enabled())
if (mmu_enabled() && mmu_is_translated<MMU_TT_DWRITE>(addr, size))
{
if ((addr >> 12) != (block->vaddr >> 12) && ((addr >> 12) != ((block->vaddr + block->guest_opcodes * 2 - 1) >> 12)))
// When full mmu is on, only consider addresses in the same 4k page

View File

@ -1526,7 +1526,7 @@ private:
return false;
u32 size = op.flags & 0x7f;
u32 addr = op.rs1._imm;
if (mmu_enabled())
if (mmu_enabled() && mmu_is_translated<MMU_TT_DREAD>(addr, size))
{
if ((addr >> 12) != (block->vaddr >> 12))
// When full mmu is on, only consider addresses in the same 4k page
@ -1676,7 +1676,7 @@ private:
return false;
u32 size = op.flags & 0x7f;
u32 addr = op.rs1._imm;
if (mmu_enabled())
if (mmu_enabled() && mmu_is_translated<MMU_TT_DWRITE>(addr, size))
{
if ((addr >> 12) != (block->vaddr >> 12))
// When full mmu is on, only consider addresses in the same 4k page