diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index c7f1f31247..ae841ca4d1 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -500,6 +500,7 @@ + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 6c20122943..944dfc1436 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -1011,6 +1011,9 @@ PowerPC\Cached Interpreter + + PowerPC\Interpreter + PowerPC\Interpreter diff --git a/Source/Core/Core/PowerPC/Interpreter/ExceptionUtils.h b/Source/Core/Core/PowerPC/Interpreter/ExceptionUtils.h new file mode 100644 index 0000000000..5b3af8a832 --- /dev/null +++ b/Source/Core/Core/PowerPC/Interpreter/ExceptionUtils.h @@ -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; +} diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index fd8233473a..679517b21a 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -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; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 1bdee2fbf7..20da986ead 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -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; }