DSPCore: Prefix globals with g_

This commit is contained in:
Lioncash 2015-12-29 10:34:31 -05:00
parent 78565fabbc
commit 4bc7c0c5a8
9 changed files with 47 additions and 47 deletions

View File

@ -23,11 +23,11 @@
#include "Core/DSP/DSPIntUtil.h"
SDSP g_dsp;
DSPBreakpoints dsp_breakpoints;
DSPBreakpoints g_dsp_breakpoints;
static DSPCoreState core_state = DSPCORE_STOP;
u16 cyclesLeft = 0;
bool init_hax = false;
std::unique_ptr<DSPEmitter> dspjit;
u16 g_cycles_left = 0;
bool g_init_hax = false;
std::unique_ptr<DSPEmitter> g_dsp_jit;
std::unique_ptr<DSPCaptureLogger> g_dsp_cap;
static Common::Event step_event;
@ -101,8 +101,8 @@ static void DSPCore_FreeMemoryPages()
bool DSPCore_Init(const DSPInitOptions& opts)
{
g_dsp.step_counter = 0;
cyclesLeft = 0;
init_hax = false;
g_cycles_left = 0;
g_init_hax = false;
g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE);
g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE);
@ -147,7 +147,7 @@ bool DSPCore_Init(const DSPInitOptions& opts)
// Initialize JIT, if necessary
if (opts.core_type == DSPInitOptions::CORE_JIT)
dspjit = std::make_unique<DSPEmitter>();
g_dsp_jit = std::make_unique<DSPEmitter>();
g_dsp_cap.reset(opts.capture_logger);
@ -162,7 +162,7 @@ void DSPCore_Shutdown()
core_state = DSPCORE_STOP;
dspjit.reset();
g_dsp_jit.reset();
DSPCore_FreeMemoryPages();
@ -241,7 +241,7 @@ void DSPCore_CheckExceptions()
// Handle state changes and stepping.
int DSPCore_RunCycles(int cycles)
{
if (dspjit)
if (g_dsp_jit)
{
if (g_dsp.external_interrupt_waiting)
{
@ -250,14 +250,14 @@ int DSPCore_RunCycles(int cycles)
DSPCore_SetExternalInterrupt(false);
}
cyclesLeft = cycles;
DSPCompiledCode pExecAddr = (DSPCompiledCode)dspjit->enterDispatcher;
g_cycles_left = cycles;
DSPCompiledCode pExecAddr = (DSPCompiledCode)g_dsp_jit->enterDispatcher;
pExecAddr();
if (g_dsp.reset_dspjit_codespace)
dspjit->ClearIRAMandDSPJITCodespaceReset();
g_dsp_jit->ClearIRAMandDSPJITCodespaceReset();
return cyclesLeft;
return g_cycles_left;
}
while (cycles > 0)
@ -313,7 +313,7 @@ void DSPCore_Step()
void CompileCurrent()
{
dspjit->Compile(g_dsp.pc);
g_dsp_jit->Compile(g_dsp.pc);
bool retry = true;
@ -322,11 +322,11 @@ void CompileCurrent()
retry = false;
for (u16 i = 0x0000; i < 0xffff; ++i)
{
if (!dspjit->unresolvedJumps[i].empty())
if (!g_dsp_jit->unresolvedJumps[i].empty())
{
u16 addrToCompile = dspjit->unresolvedJumps[i].front();
dspjit->Compile(addrToCompile);
if (!dspjit->unresolvedJumps[i].empty())
u16 addrToCompile = g_dsp_jit->unresolvedJumps[i].front();
g_dsp_jit->Compile(addrToCompile);
if (!g_dsp_jit->unresolvedJumps[i].empty())
retry = true;
}
}

View File

@ -296,10 +296,10 @@ struct SDSP
};
extern SDSP g_dsp;
extern DSPBreakpoints dsp_breakpoints;
extern u16 cyclesLeft;
extern bool init_hax;
extern std::unique_ptr<DSPEmitter> dspjit;
extern DSPBreakpoints g_dsp_breakpoints;
extern u16 g_cycles_left;
extern bool g_init_hax;
extern std::unique_ptr<DSPEmitter> g_dsp_jit;
extern std::unique_ptr<DSPCaptureLogger> g_dsp_cap;
struct DSPInitOptions

View File

@ -410,7 +410,7 @@ void DSPEmitter::CompileDispatcher()
returnDispatcher = GetCodePtr();
// Decrement cyclesLeft
SUB(16, M(&cyclesLeft), R(EAX));
SUB(16, M(&g_cycles_left), R(EAX));
J_CC(CC_A, dispatcherLoop);

View File

@ -57,7 +57,7 @@ void gdsp_mbox_write_l(Mailbox mbx, u16 val)
u16 gdsp_mbox_read_h(Mailbox mbx)
{
if (init_hax && mbx == MAILBOX_DSP)
if (g_init_hax && mbx == MAILBOX_DSP)
{
return 0x8054;
}
@ -70,9 +70,9 @@ u16 gdsp_mbox_read_l(Mailbox mbx)
const u32 value = g_dsp.mbox[mbx].load(std::memory_order_acquire);
g_dsp.mbox[mbx].store(value & ~0x80000000, std::memory_order_release);
if (init_hax && mbx == MAILBOX_DSP)
if (g_init_hax && mbx == MAILBOX_DSP)
{
init_hax = false;
g_init_hax = false;
DSPCore_Reset();
return 0x4348;
}

View File

@ -30,7 +30,7 @@ void WriteCR(u16 val)
// HAX!
// OSInitAudioSystem ucode should send this mail - not DSP core itself
INFO_LOG(DSPLLE,"DSP_CONTROL INIT");
init_hax = true;
g_init_hax = true;
val |= 0x800;
}
@ -109,7 +109,7 @@ int RunCyclesDebug(int cycles)
{
if (g_dsp.cr & CR_HALT)
return 0;
if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
{
DSPCore_SetState(DSPCORE_STEPPING);
return cycles;
@ -128,7 +128,7 @@ int RunCyclesDebug(int cycles)
{
if (g_dsp.cr & CR_HALT)
return 0;
if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
{
DSPCore_SetState(DSPCORE_STEPPING);
return cycles;
@ -145,7 +145,7 @@ int RunCyclesDebug(int cycles)
// Now, lets run some more without idle skipping.
for (int i = 0; i < 200; i++)
{
if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
{
DSPCore_SetState(DSPCORE_STEPPING);
return cycles;

View File

@ -99,12 +99,12 @@ static void WriteBlockLink(DSPEmitter& emitter, u16 dest)
{
emitter.gpr.FlushRegs();
// Check if we have enough cycles to execute the next block
emitter.MOV(16, R(ECX), M(&cyclesLeft));
emitter.MOV(16, R(ECX), M(&g_cycles_left));
emitter.CMP(16, R(ECX), Imm16(emitter.blockSize[emitter.startAddr] + emitter.blockSize[dest]));
FixupBranch notEnoughCycles = emitter.J_CC(CC_BE);
emitter.SUB(16, R(ECX), Imm16(emitter.blockSize[emitter.startAddr]));
emitter.MOV(16, M(&cyclesLeft), R(ECX));
emitter.MOV(16, M(&g_cycles_left), R(ECX));
emitter.JMP(emitter.blockLinks[dest], true);
emitter.SetJumpTarget(notEnoughCycles);
}

View File

@ -75,8 +75,8 @@ bool DSPDebugInterface::IsBreakpoint(unsigned int address)
{
int real_addr = DSPSymbols::Line2Addr(address);
if (real_addr >= 0)
return dsp_breakpoints.IsAddressBreakPoint(real_addr);
else
return g_dsp_breakpoints.IsAddressBreakPoint(real_addr);
return false;
}
@ -86,7 +86,7 @@ void DSPDebugInterface::SetBreakpoint(unsigned int address)
if (real_addr >= 0)
{
if (dsp_breakpoints.Add(real_addr))
if (g_dsp_breakpoints.Add(real_addr))
{
}
@ -99,7 +99,7 @@ void DSPDebugInterface::ClearBreakpoint(unsigned int address)
if (real_addr >= 0)
{
if (dsp_breakpoints.Remove(real_addr))
if (g_dsp_breakpoints.Remove(real_addr))
{
}
@ -108,7 +108,7 @@ void DSPDebugInterface::ClearBreakpoint(unsigned int address)
void DSPDebugInterface::ClearAllBreakpoints()
{
dsp_breakpoints.Clear();
g_dsp_breakpoints.Clear();
}
void DSPDebugInterface::ToggleBreakpoint(unsigned int address)
@ -116,10 +116,10 @@ void DSPDebugInterface::ToggleBreakpoint(unsigned int address)
int real_addr = DSPSymbols::Line2Addr(address);
if (real_addr >= 0)
{
if (dsp_breakpoints.IsAddressBreakPoint(real_addr))
dsp_breakpoints.Remove(real_addr);
if (g_dsp_breakpoints.IsAddressBreakPoint(real_addr))
g_dsp_breakpoints.Remove(real_addr);
else
dsp_breakpoints.Add(real_addr);
g_dsp_breakpoints.Add(real_addr);
}
}

View File

@ -96,8 +96,8 @@ void CodeLoaded(const u8 *ptr, int size)
UpdateDebugger();
if (dspjit)
dspjit->ClearIRAM();
if (g_dsp_jit)
g_dsp_jit->ClearIRAM();
DSPAnalyzer::Analyze();
}

View File

@ -83,8 +83,8 @@ void DSPLLE::DoState(PointerWrap &p)
if (p.GetMode() == PointerWrap::MODE_READ)
DSPHost::CodeLoaded((const u8*)g_dsp.iram, DSP_IRAM_BYTE_SIZE);
p.DoArray(g_dsp.dram, DSP_DRAM_SIZE);
p.Do(cyclesLeft);
p.Do(init_hax);
p.Do(g_cycles_left);
p.Do(g_init_hax);
p.Do(m_cycle_count);
}
@ -99,7 +99,7 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle)
if (cycles > 0)
{
std::lock_guard<std::mutex> dsp_thread_lock(dsp_lle->m_csDSPThreadActive);
if (dspjit)
if (g_dsp_jit)
{
DSPCore_RunCycles(cycles);
}
@ -176,7 +176,7 @@ bool DSPLLE::Initialize(bool bWii, bool bDSPThread)
// needs to be after DSPCore_Init for the dspjit ptr
if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive() ||
Core::g_want_determinism || !dspjit)
Core::g_want_determinism || !g_dsp_jit)
{
bDSPThread = false;
}