diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj
index 2de38a011b..7215007250 100644
--- a/Source/Core/Core/Core.vcproj
+++ b/Source/Core/Core/Core.vcproj
@@ -1010,14 +1010,6 @@
RelativePath=".\Src\PowerPC\Jit64\JitCache.h"
>
-
-
-
-
diff --git a/Source/Core/Core/Src/Boot/Boot.h b/Source/Core/Core/Src/Boot/Boot.h
index ba7bbe4228..015e78a9c9 100644
--- a/Source/Core/Core/Src/Boot/Boot.h
+++ b/Source/Core/Core/Src/Boot/Boot.h
@@ -44,7 +44,7 @@ public:
private:
enum { BIOS_SIZE = 2*1024*1024 };
- static void RunFunction(u32 _iAddr, bool _bUseDebugger);
+ static void RunFunction(u32 _iAddr);
static void UpdateDebugger_MapLoaded(const char* _gameID = NULL);
diff --git a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp b/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp
index 2bf3c04180..cf7a30f5aa 100644
--- a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp
+++ b/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp
@@ -32,30 +32,18 @@
#include "VolumeCreator.h"
#include "Boot.h"
-void CBoot::RunFunction(u32 _iAddr, bool _bUseDebugger)
+void CBoot::RunFunction(u32 _iAddr)
{
PC = _iAddr;
LR = 0x00;
- if (_bUseDebugger)
- {
- CCPU::Break();
- while (PC != 0x00)
- CCPU::SingleStep();
- }
- else
- {
- while (PC != 0x00)
- PowerPC::SingleStep();
- }
+ while (PC != 0x00)
+ PowerPC::SingleStep();
}
-// __________________________________________________________________________________________________
-//
// BIOS HLE:
// copy the apploader to 0x81200000
-// execute the apploader
-//
+// execute the apploader, function by function, using the above utility.
void CBoot::EmulatedBIOS(bool _bDebug)
{
LOG(BOOT, "Faking GC BIOS...");
@@ -102,24 +90,22 @@ void CBoot::EmulatedBIOS(bool _bDebug)
VolumeHandler::ReadToPtr(Memory::GetPointer(0x81200000), iAppLoaderOffset + 0x20, iAppLoaderSize);
// =======================================================================================
-
- //call iAppLoaderEntry
+ // Call iAppLoaderEntry.
LOG(MASTER_LOG, "Call iAppLoaderEntry");
u32 iAppLoaderFuncAddr = 0x80003100;
PowerPC::ppcState.gpr[3] = iAppLoaderFuncAddr + 0;
PowerPC::ppcState.gpr[4] = iAppLoaderFuncAddr + 4;
PowerPC::ppcState.gpr[5] = iAppLoaderFuncAddr + 8;
- RunFunction(iAppLoaderEntry, _bDebug);
- u32 iAppLoaderInit = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+0);
- u32 iAppLoaderMain = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+4);
- u32 iAppLoaderClose = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+8);
+ RunFunction(iAppLoaderEntry);
+ u32 iAppLoaderInit = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr + 0);
+ u32 iAppLoaderMain = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr + 4);
+ u32 iAppLoaderClose = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr + 8);
// iAppLoaderInit
LOG(MASTER_LOG, "Call iAppLoaderInit");
PowerPC::ppcState.gpr[3] = 0x81300000;
- RunFunction(iAppLoaderInit, _bDebug);
-
+ RunFunction(iAppLoaderInit);
// =======================================================================================
/* iAppLoaderMain - Here we load the apploader, the DOL (the exe) and the FST (filesystem).
@@ -133,7 +119,7 @@ void CBoot::EmulatedBIOS(bool _bDebug)
PowerPC::ppcState.gpr[4] = 0x81300008;
PowerPC::ppcState.gpr[5] = 0x8130000c;
- RunFunction(iAppLoaderMain, _bDebug);
+ RunFunction(iAppLoaderMain);
u32 iRamAddress = Memory::ReadUnchecked_U32(0x81300004);
u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
@@ -145,10 +131,9 @@ void CBoot::EmulatedBIOS(bool _bDebug)
} while(PowerPC::ppcState.gpr[3] != 0x00);
// =======================================================================================
-
// iAppLoaderClose
LOG(MASTER_LOG, "call iAppLoaderClose");
- RunFunction(iAppLoaderClose, _bDebug);
+ RunFunction(iAppLoaderClose);
// Load patches
std::string gameID = VolumeHandler::GetVolume()->GetUniqueID();
@@ -354,7 +339,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
PowerPC::ppcState.gpr[3] = iAppLoaderFuncAddr + 0;
PowerPC::ppcState.gpr[4] = iAppLoaderFuncAddr + 4;
PowerPC::ppcState.gpr[5] = iAppLoaderFuncAddr + 8;
- RunFunction(iAppLoaderEntry, _bDebug);
+ RunFunction(iAppLoaderEntry);
u32 iAppLoaderInit = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+0);
u32 iAppLoaderMain = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+4);
u32 iAppLoaderClose = Memory::ReadUnchecked_U32(iAppLoaderFuncAddr+8);
@@ -362,7 +347,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
// iAppLoaderInit
LOG(BOOT, "Call iAppLoaderInit");
PowerPC::ppcState.gpr[3] = 0x81300000;
- RunFunction(iAppLoaderInit, _bDebug);
+ RunFunction(iAppLoaderInit);
// iAppLoaderMain
LOG(BOOT, "Call iAppLoaderMain");
@@ -372,7 +357,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
PowerPC::ppcState.gpr[4] = 0x81300008;
PowerPC::ppcState.gpr[5] = 0x8130000c;
- RunFunction(iAppLoaderMain, _bDebug);
+ RunFunction(iAppLoaderMain);
u32 iRamAddress = Memory::ReadUnchecked_U32(0x81300004);
u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
@@ -384,7 +369,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
// iAppLoaderClose
LOG(BOOT, "call iAppLoaderClose");
- RunFunction(iAppLoaderClose, _bDebug);
+ RunFunction(iAppLoaderClose);
// Load patches and run startup patches
std::string gameID = VolumeHandler::GetVolume()->GetUniqueID();
diff --git a/Source/Core/Core/Src/HW/CPU.cpp b/Source/Core/Core/Src/HW/CPU.cpp
index a7f1ed6c55..c5513df6a0 100644
--- a/Source/Core/Core/Src/HW/CPU.cpp
+++ b/Source/Core/Core/Src/HW/CPU.cpp
@@ -27,7 +27,9 @@
#include "../Debugger/Debugger_BreakPoints.h"
using namespace PowerPC;
-namespace {
+
+namespace
+{
static bool g_Branch;
static Common::Event m_StepEvent;
static Common::Event *m_SyncEvent;
@@ -53,52 +55,22 @@ void CCPU::Run()
while (true)
{
- switch(PowerPC::state) {
+reswitch:
+ switch (PowerPC::state)
+ {
case CPU_RUNNING:
//1: enter a fast runloop
PowerPC::RunLoop();
break;
- case CPU_RUNNINGDEBUG:
- //1: check for cpucompare
- /*
- if (CPUCompare::IsEnabled() && g_Branch)
- {
- g_Branch = false;
- CPUCompare::Sync();
- }*/
-
- //2: check for breakpoint
- if (BreakPoints::IsAddressBreakPoint(PC))
- {
- LOG(GEKKO, "Hit Breakpoint - %08x", PC);
- EnableStepping(true);
- if (BreakPoints::IsTempBreakPoint(PC))
- BreakPoints::Remove(PC);
-
- Host_UpdateDisasmDialog();
-
- break;
- }
-
-/* if (!Core::g_CoreStartupParameter.bUseJIT && BreakPoints::GetBreakCount() == PowerPC::ppcState.DebugCount)
- {
- LOG(GEKKO, "Hit DebugCount breakpoint - %i", PowerPC::ppcState.DebugCount);
- EnableStepping(true);
- break;
- }*/
-
- //3: do a step
- PowerPC::SingleStep();
- break;
-
case CPU_STEPPING:
- //1: wait for step command..
-
m_StepEvent.Wait();
+ //1: wait for step command..
if (state == CPU_POWERDOWN)
return;
-
+ if (state != CPU_STEPPING)
+ goto reswitch;
+
//2: check for cpu compare
if (CPUCompare::IsEnabled() && g_Branch)
{
@@ -165,65 +137,6 @@ void CCPU::EnableStepping(const bool _bStepping)
}
}
-void CCPU::SingleStep()
-{
- switch (PowerPC::state)
- {
- case CPU_RUNNING:
- //1: enter a fast runloop
- PowerPC::RunLoop();
- break;
-
- case CPU_RUNNINGDEBUG:
- //1: check for cpucompare
- if (CPUCompare::IsEnabled() && g_Branch)
- {
- g_Branch = false;
- CPUCompare::Sync();
- }
-
- //2: check for breakpoint
- if (BreakPoints::IsAddressBreakPoint(PC))
- {
- LOG(GEKKO, "Hit Breakpoint - %08x", PC);
- EnableStepping(true);
- if (BreakPoints::IsTempBreakPoint(PC))
- BreakPoints::Remove(PC);
- break;
- }
-
- //3: do a step
- PowerPC::SingleStep();
- break;
-
- case CPU_STEPPING:
- //1: wait for step command..
- m_StepEvent.Wait();
-
- //2: check for cpu compare
- if (CPUCompare::IsEnabled() && g_Branch)
- {
- g_Branch = false;
- CPUCompare::Sync();
- }
-
- //3: do a step
- PowerPC::SingleStep();
-
- //4: update disasm dialog
- if (m_SyncEvent) {
- m_SyncEvent->Set();
- m_SyncEvent = 0;
- }
- Host_UpdateDisasmDialog();
- break;
-
- case CPU_POWERDOWN:
- //1: Exit loop!!
- return;
- }
-}
-
void CCPU::Break()
{
EnableStepping(true);
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
index 9cf8855fc2..398829f3af 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
@@ -17,9 +17,11 @@
#include "../../HW/Memmap.h"
#include "../../HW/CPU.h"
+#include "../../Host.h"
#include "../PPCTables.h"
#include "Interpreter.h"
#include "../../Debugger/Debugger_SymbolMap.h"
+#include "../../Debugger/Debugger_Breakpoints.h"
#include "../../CoreTiming.h"
#include "../../Core.h"
#include "PowerPCDisasm.h"
@@ -134,15 +136,46 @@ void Run()
while (!PowerPC::state)
{
//we have to check exceptions at branches apparently (or maybe just rfi?)
- while (CoreTiming::downcount > 0)
+ if (Core::GetStartupParameter().bEnableDebugging)
{
- m_EndBlock = false;
- int i;
- for (i = 0; !m_EndBlock; i++)
+ // Debugging friendly version of inner loop. Tries to do the timing as similarly to the
+ // JIT as possible. Does not take into account that some instructions take multiple cycles.
+ while (CoreTiming::downcount > 0)
{
- SingleStepInner();
+ m_EndBlock = false;
+ int i;
+ for (i = 0; !m_EndBlock; i++)
+ {
+ //2: check for breakpoint
+ if (BreakPoints::IsAddressBreakPoint(PC))
+ {
+ LOG(GEKKO, "Hit Breakpoint - %08x", PC);
+ CCPU::EnableStepping(true);
+ if (BreakPoints::IsTempBreakPoint(PC))
+ BreakPoints::Remove(PC);
+
+ Host_UpdateDisasmDialog();
+ return;
+ }
+
+ SingleStepInner();
+ }
+ CoreTiming::downcount -= i;
+ }
+ }
+ else
+ {
+ // "fast" version of inner loop. well, it's not so fast.
+ while (CoreTiming::downcount > 0)
+ {
+ m_EndBlock = false;
+ int i;
+ for (i = 0; !m_EndBlock; i++)
+ {
+ SingleStepInner();
+ }
+ CoreTiming::downcount -= i;
}
- CoreTiming::downcount -= i;
}
CoreTiming::Advance();
diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp
index 4c78609ce8..7889b673e2 100644
--- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp
+++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp
@@ -173,10 +173,9 @@ namespace CPUCompare
void Jit64::Init()
{
+ asm_routines.compareEnabled = ::Core::g_CoreStartupParameter.bRunCompareClient;
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
- {
CODE_SIZE = 1024*1024*8*8;
- }
jo.optimizeStack = true;
jo.enableBlocklink = false; // Speed boost, but not 100% safe
@@ -351,12 +350,13 @@ namespace CPUCompare
void Jit64::SingleStep()
{
// NOT USED, NOT TESTED, PROBABLY NOT WORKING YET
-
+ // PanicAlert("Single");
+ /*
JitBlock temp_block;
PPCAnalyst::CodeBuffer temp_codebuffer(1); // Only room for one instruction! Single step!
const u8 *code = DoJit(PowerPC::ppcState.pc, &temp_codebuffer, &temp_block);
CompiledCode pExecAddr = (CompiledCode)code;
- pExecAddr();
+ pExecAddr();*/
}
void Jit64::Jit(u32 em_address)
diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp
deleted file mode 100644
index 98a84a3960..0000000000
--- a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#include "JitCore.h"
-#include "JitCache.h"
-#include "JitAsm.h"
-#include "Jit.h"
-
-#include "../../HW/Memmap.h"
-#include "../../HW/CPU.h"
-#include "../../HW/DSP.h"
-#include "../../HW/GPFifo.h"
-
-#include "../../HW/VideoInterface.h"
-#include "../../HW/SerialInterface.h"
-#include "../../Core.h"
-
-namespace JitCore
-{
-
-void Init()
-{
- jit.Init();
- asm_routines.compareEnabled = ::Core::g_CoreStartupParameter.bRunCompareClient;
-}
-
-void Shutdown()
-{
- jit.Shutdown();
-}
-
-void SingleStep()
-{
- Run();
-}
-
-void Run()
-{
- jit.Run();
-}
-
-} // namespace
diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h
deleted file mode 100644
index 714c271d4e..0000000000
--- a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#ifndef _JITCORE_H
-#define _JITCORE_H
-
-namespace JitCore
-{
- void Init();
- void Shutdown();
- void Reset();
- void SingleStep();
- void Run();
-}
-
-#endif
-
diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.cpp b/Source/Core/Core/Src/PowerPC/PowerPC.cpp
index 18b201c63a..4df8980b88 100644
--- a/Source/Core/Core/Src/PowerPC/PowerPC.cpp
+++ b/Source/Core/Core/Src/PowerPC/PowerPC.cpp
@@ -27,7 +27,6 @@
#include "Interpreter/Interpreter.h"
#include "Jit64/Jit.h"
-#include "Jit64/JitCore.h"
#include "Jit64/JitCache.h"
#include "PowerPC.h"
#include "PPCTables.h"
@@ -118,7 +117,7 @@ void Init()
// Initialize both execution engines ...
Interpreter::Init();
- JitCore::Init();
+ jit.Init();
// ... but start as interpreter by default.
mode = MODE_INTERPRETER;
state = CPU_STEPPING;
@@ -127,7 +126,7 @@ void Init()
void Shutdown()
{
// Shutdown both execution engines. Doesn't matter which one is active.
- JitCore::Shutdown();
+ jit.Shutdown();
Interpreter::Shutdown();
}
@@ -157,7 +156,7 @@ void SingleStep()
Interpreter::SingleStep();
break;
case MODE_JIT:
- JitCore::SingleStep();
+ jit.SingleStep();
break;
}
}
@@ -171,7 +170,7 @@ void RunLoop()
Interpreter::Run();
break;
case MODE_JIT:
- JitCore::Run();
+ jit.Run();
break;
}
Host_UpdateDisasmDialog();
@@ -180,11 +179,7 @@ void RunLoop()
void Start()
{
// Select running mode for CPU.cpp
- state = Core::g_CoreStartupParameter.bEnableDebugging ? CPU_RUNNINGDEBUG : CPU_RUNNING;
- if (Core::bReadTrace || Core::bWriteTrace)
- {
- state = CPU_RUNNING;
- }
+ state = CPU_RUNNING;
Host_UpdateDisasmDialog();
}
diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.h b/Source/Core/Core/Src/PowerPC/PowerPC.h
index 8240c2bd83..9eae9c0be4 100644
--- a/Source/Core/Core/Src/PowerPC/PowerPC.h
+++ b/Source/Core/Core/Src/PowerPC/PowerPC.h
@@ -67,7 +67,6 @@ struct GC_ALIGNED64(PowerPCState)
enum CPUState
{
CPU_RUNNING = 0,
- CPU_RUNNINGDEBUG = 1,
CPU_STEPPING = 2,
CPU_POWERDOWN = 3,
};
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index c1cd760bca..ff81a4e1cf 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -690,7 +690,6 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
case IDM_STEP:
SingleCPUStep();
-
break;
case IDM_STEPOVER: