From 6918a9e1d6f30aa43c3bbeabcd27dfe2a3c6527c Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 11 Aug 2010 10:45:27 +0000 Subject: [PATCH] Added support for multiboot dols. This allows demo discs, bonus discs etc to be played. * Flushed the JIT cache on "ICFI" (Flush Instruction Cache) * Made all instructions one cycle in duration Fixes issue 233 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6088 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/Memmap.cpp | 2 +- .../Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp | 1 - Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 2 +- Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp | 7 +++++++ Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h | 1 + Source/Core/Core/Src/PowerPC/PPCCache.cpp | 6 ++++++ Source/Core/DebuggerWX/Src/CodeWindow.cpp | 5 ++++- 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index 52028cc914..c700cbd671 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -660,7 +660,7 @@ u8 *GetPointer(const u32 _Address) } else { - if (!PanicYesNo("Unknown pointer address prefix %02X, report this to the devs: 0x%08X \n Continue?", (_Address >> 24), _Address)) + if (!Core::g_CoreStartupParameter.bMMU && !PanicYesNo("Unknown pointer address prefix %02X, report this to the devs: 0x%08X \n Continue?", (_Address >> 24), _Address)) Crash(); return 0; } diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 93185aa413..ea9e3c479d 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -455,7 +455,6 @@ void icbi(UGeckoInstruction _inst) { u32 address = Helper_Get_EA_X(_inst); PowerPC::ppcState.iCache.Invalidate(address); - jit->GetBlockCache()->InvalidateICache(address); } void lbzux(UGeckoInstruction _inst) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 4c320f4810..e959dc0dca 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -516,7 +516,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc js.op = &ops[i]; js.instructionNumber = i; const GekkoOPInfo *opinfo = ops[i].opinfo; - js.downcountAmount += (opinfo->numCyclesMinusOne + 1); + js.downcountAmount++; if (i == (int)size - 1) { diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp index 6b9d85ab0a..b1651f1a7e 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp @@ -138,6 +138,13 @@ bool JitBlock::ContainsAddress(u32 em_address) memset(blockCodePointers, 0, sizeof(u8*)*MAX_NUM_BLOCKS); } + void JitBlockCache::ClearSafe() + { + memset(iCache, JIT_ICACHE_INVALID_BYTE, JIT_ICACHE_SIZE); + memset(iCacheEx, JIT_ICACHE_INVALID_BYTE, JIT_ICACHEEX_SIZE); + memset(iCacheVMEM, JIT_ICACHE_INVALID_BYTE, JIT_ICACHE_SIZE); + } + /*void JitBlockCache::DestroyBlocksWithFlag(BlockFlag death_flag) { for (int i = 0; i < num_blocks; i++) diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h index f99d67a9b8..91d47a3d0e 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h @@ -99,6 +99,7 @@ public: void FinalizeBlock(int block_num, bool block_link, const u8 *code_ptr); void Clear(); + void ClearSafe(); void Init(); void Shutdown(); void Reset(); diff --git a/Source/Core/Core/Src/PowerPC/PPCCache.cpp b/Source/Core/Core/Src/PowerPC/PPCCache.cpp index ec9841f417..33ecc0ee88 100644 --- a/Source/Core/Core/Src/PowerPC/PPCCache.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCCache.cpp @@ -18,6 +18,8 @@ #include "PPCCache.h" #include "../HW/Memmap.h" #include "PowerPC.h" +#include "JitCommon/JitBase.h" +#include "JitCommon/JitCache.h" namespace PowerPC { @@ -74,10 +76,14 @@ namespace PowerPC memset(lookup_table_ex, 0xff, sizeof(lookup_table_ex)); memset(lookup_table_vmem, 0xff, sizeof(lookup_table_vmem)); #endif + if (jit) + jit->GetBlockCache()->ClearSafe(); } void InstructionCache::Invalidate(u32 addr) { + if (jit) + jit->GetBlockCache()->InvalidateICache(addr); if (!HID0.ICE) return; // invalidates the whole set diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index e62ab669f2..e0f7678964 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -560,7 +560,10 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event) } // Clear the JIT cache to enable these changes - jit->ClearCache(); + if (jit) + { + jit->ClearCache(); + } // Update UpdateButtonStates(); }