From bac3f878e86850e04aaef916024f4e27b948dbd6 Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Wed, 15 Oct 2008 12:47:43 +0000 Subject: [PATCH] added support for instruction read exceptions in interpreter git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@877 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/Memmap.cpp | 15 +++++++++++++++ Source/Core/Core/Src/HW/Memmap.h | 2 ++ .../Core/Src/PowerPC/Interpreter/Interpreter.cpp | 6 +----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index e9b69ee923..f76dc760d5 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -605,6 +605,21 @@ u32 Read_Instruction(const u32 _Address) return Jit64::GetOriginalCode(_Address); } +u32 Read_Opcode(const u32 _Address) +{ +#ifdef LOGGING + if (_Address == 0x00000000) + { + PanicAlert("Program tried to read from [00000000]"); + return 0x00000000; + } +#endif + + u32 _var = 0; + ReadFromHardware2(_var, 32, _Address, _Address, FLAG_OPCODE); + + return _var; +} u8 Read_U8(const u32 _Address) { diff --git a/Source/Core/Core/Src/HW/Memmap.h b/Source/Core/Core/Src/HW/Memmap.h index ac7a8427cf..87d383ed33 100644 --- a/Source/Core/Core/Src/HW/Memmap.h +++ b/Source/Core/Core/Src/HW/Memmap.h @@ -95,6 +95,8 @@ namespace Memory #endif } + u32 Read_Opcode(const u32 _Address); + //For use by emulator u8 Read_U8(const u32 _Address); u16 Read_U16(const u32 _Address); diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp index 21957fad4a..743eb16da9 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp @@ -81,14 +81,10 @@ void patches() } void SingleStepInner(void) { -/* static int count = 0; - count++; - if ((count % 50) == 0) - PluginDSP::DSP_Update(); */ static UGeckoInstruction instCode; NPC = PC + sizeof(UGeckoInstruction); - instCode.hex = Memory::ReadFast32(PC); // Memory::ReadUnchecked_U32(PC); + instCode.hex = Memory::Read_Opcode(PC); UReg_MSR& msr = (UReg_MSR&)MSR; if (msr.FP) //If FPU is enabled, just execute