Commit ee60ab3a authored by Libretro-Admin's avatar Libretro-Admin
Browse files
parent dd4aec7e
Pipeline #16309 failed with stages
in 2 minutes and 17 seconds
......@@ -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);
......
......@@ -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
;
......
......@@ -1559,7 +1559,7 @@ private:
u32 size = op.flags & 0x7f;
u32 addr = op.rs1._imm;
#ifndef NO_MMU
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
......@@ -1782,7 +1782,7 @@ private:
u32 size = op.flags & 0x7f;
u32 addr = op.rs1._imm;
#ifndef NO_MMU
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
......
......@@ -1468,7 +1468,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
......@@ -1618,7 +1618,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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment