Permalink
Browse files

Merge pull request #6925 from lioncash/exception

Interpreter: Move common exception functions to ExceptionUtils.h
  • Loading branch information...
Tilka committed May 21, 2018
2 parents 3d8e63f + 3edf0f1 commit 9806583b1e59fac760a5eaa505b6a030dae332a9
@@ -500,6 +500,7 @@
<ClInclude Include="PowerPC\Gekko.h" />
<ClInclude Include="PowerPC\CachedInterpreter\CachedInterpreter.h" />
<ClInclude Include="PowerPC\CachedInterpreter\InterpreterBlockCache.h" />
<ClInclude Include="PowerPC\Interpreter\ExceptionUtils.h" />
<ClInclude Include="PowerPC\Interpreter\Interpreter.h" />
<ClInclude Include="PowerPC\Interpreter\Interpreter_FPUtils.h" />
<ClInclude Include="PowerPC\Jit64Common\ConstantPool.h" />
@@ -1011,6 +1011,9 @@
<ClInclude Include="PowerPC\CachedInterpreter\InterpreterBlockCache.h">
<Filter>PowerPC\Cached Interpreter</Filter>
</ClInclude>
<ClInclude Include="PowerPC\Interpreter\ExceptionUtils.h">
<Filter>PowerPC\Interpreter</Filter>
</ClInclude>
<ClInclude Include="PowerPC\Interpreter\Interpreter.h">
<Filter>PowerPC\Interpreter</Filter>
</ClInclude>
@@ -0,0 +1,26 @@
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/PowerPC.h"
inline void GenerateAlignmentException(u32 address)
{
PowerPC::ppcState.Exceptions |= EXCEPTION_ALIGNMENT;
PowerPC::ppcState.spr[SPR_DAR] = address;
}
inline void GenerateDSIException(u32 address)
{
PowerPC::ppcState.Exceptions |= EXCEPTION_DSI;
PowerPC::ppcState.spr[SPR_DAR] = address;
}
inline void GenerateProgramException()
{
PowerPC::ppcState.Exceptions |= EXCEPTION_PROGRAM;
}
@@ -9,6 +9,7 @@
#include "Common/Swap.h"
#include "Core/ConfigManager.h"
#include "Core/PowerPC/Interpreter/ExceptionUtils.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/JitInterface.h"
@@ -18,26 +19,6 @@
bool Interpreter::m_reserve;
u32 Interpreter::m_reserve_address;
namespace
{
void GenerateAlignmentException(u32 address)
{
PowerPC::ppcState.Exceptions |= EXCEPTION_ALIGNMENT;
PowerPC::ppcState.spr[SPR_DAR] = address;
}
void GenerateDSIException(u32 address)
{
PowerPC::ppcState.Exceptions |= EXCEPTION_DSI;
PowerPC::ppcState.spr[SPR_DAR] = address;
}
void GenerateProgramException()
{
PowerPC::ppcState.Exceptions |= EXCEPTION_PROGRAM;
}
}
u32 Interpreter::Helper_Get_EA(const UGeckoInstruction inst)
{
return inst.RA ? (rGPR[inst.RA] + inst.SIMM_16) : (u32)inst.SIMM_16;
@@ -12,6 +12,7 @@
#include "Common/Logging/Log.h"
#include "Core/HW/GPFifo.h"
#include "Core/HW/SystemTimers.h"
#include "Core/PowerPC/Interpreter/ExceptionUtils.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PowerPC.h"
@@ -198,7 +199,7 @@ void Interpreter::mfspr(UGeckoInstruction inst)
if (MSR.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR && index != SPR_TL &&
index != SPR_TU)
{
PowerPC::ppcState.Exceptions |= EXCEPTION_PROGRAM;
GenerateProgramException();
return;
}
@@ -245,7 +246,7 @@ void Interpreter::mtspr(UGeckoInstruction inst)
// XER, LR, and CTR are the only ones available to be written to in user mode
if (MSR.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR)
{
PowerPC::ppcState.Exceptions |= EXCEPTION_PROGRAM;
GenerateProgramException();
return;
}

0 comments on commit 9806583

Please sign in to comment.