Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize faulting stuff. Differentiate between arch- and OS-specific defines. #1449

Merged
merged 1 commit into from
Nov 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 0 additions & 78 deletions Source/Core/Core/ArmMemTools.cpp

This file was deleted.

3 changes: 1 addition & 2 deletions Source/Core/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(SRCS ActionReplay.cpp
ec_wii.cpp
GeckoCodeConfig.cpp
GeckoCode.cpp
MemTools.cpp
Movie.cpp
NetPlayClient.cpp
NetPlayServer.cpp
Expand Down Expand Up @@ -179,7 +180,6 @@ set(SRCS ActionReplay.cpp

if(_M_X86)
set(SRCS ${SRCS}
x64MemTools.cpp
PowerPC/Jit64IL/IR_X86.cpp
PowerPC/Jit64IL/JitIL.cpp
PowerPC/Jit64IL/JitIL_Tables.cpp
Expand All @@ -201,7 +201,6 @@ if(_M_X86)
PowerPC/JitCommon/TrampolineCache.cpp)
elseif(_M_ARM_32)
set(SRCS ${SRCS}
ArmMemTools.cpp
PowerPC/JitArm32/Jit.cpp
PowerPC/JitArm32/JitAsm.cpp
PowerPC/JitArm32/JitArm_BackPatch.cpp
Expand Down
4 changes: 0 additions & 4 deletions Source/Core/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,8 @@ static void CpuThread()
g_video_backend->Video_Prepare();
}

#if _M_X86_64 || _M_ARM_32
if (_CoreParameter.bFastmem)
EMM::InstallExceptionHandler(); // Let's run under memory watch
#endif

if (!s_state_filename.empty())
State::LoadAs(s_state_filename);
Expand All @@ -283,9 +281,7 @@ static void CpuThread()
if (!_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();

#if _M_X86_64 || _M_ARM_32
EMM::UninstallExceptionHandler();
#endif

return;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_WiiMote.cpp" />
<ClCompile Include="IPC_HLE\WII_Socket.cpp" />
<ClCompile Include="MemTools.cpp" />
<ClCompile Include="Movie.cpp" />
<ClCompile Include="NetPlayClient.cpp" />
<ClCompile Include="NetPlayServer.cpp" />
Expand Down Expand Up @@ -240,7 +241,6 @@
<ClCompile Include="PowerPC\SignatureDB.cpp" />
<ClCompile Include="State.cpp" />
<ClCompile Include="VolumeHandler.cpp" />
<ClCompile Include="x64MemTools.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ActionReplay.h" />
Expand Down Expand Up @@ -383,6 +383,7 @@
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_WiiMote.h" />
<ClInclude Include="IPC_HLE\WII_Socket.h" />
<ClInclude Include="MachineContext.h" />
<ClInclude Include="MemTools.h" />
<ClInclude Include="Movie.h" />
<ClInclude Include="NetPlayClient.h" />
Expand All @@ -403,7 +404,6 @@
<ClInclude Include="PowerPC\JitILCommon\IR.h" />
<ClInclude Include="PowerPC\JitILCommon\JitILBase.h" />
<ClInclude Include="PowerPC\JitCommon\JitAsmCommon.h" />
<ClInclude Include="PowerPC\JitCommon\JitBackpatch.h" />
<ClInclude Include="PowerPC\JitCommon\JitBase.h" />
<ClInclude Include="PowerPC\JitCommon\JitCache.h" />
<ClInclude Include="PowerPC\JitCommon\Jit_Util.h" />
Expand Down
9 changes: 2 additions & 7 deletions Source/Core/Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@
<ClCompile Include="CoreParameter.cpp" />
<ClCompile Include="CoreTiming.cpp" />
<ClCompile Include="ec_wii.cpp" />
<ClCompile Include="MemTools.cpp" />
<ClCompile Include="Movie.cpp" />
<ClCompile Include="NetPlayClient.cpp" />
<ClCompile Include="NetPlayServer.cpp" />
<ClCompile Include="PatchEngine.cpp" />
<ClCompile Include="State.cpp" />
<ClCompile Include="VolumeHandler.cpp" />
<ClCompile Include="x64MemTools.cpp" />
<ClCompile Include="ActionReplay.cpp">
<Filter>ActionReplay</Filter>
</ClCompile>
Expand Down Expand Up @@ -631,9 +631,6 @@
<ClCompile Include="PowerPC\JitCommon\JitAsmCommon.cpp">
<Filter>PowerPC\JitCommon</Filter>
</ClCompile>
<ClCompile Include="PowerPC\JitCommon\JitBackpatch.cpp">
<Filter>PowerPC\JitCommon</Filter>
</ClCompile>
<ClCompile Include="PowerPC\JitCommon\JitBase.cpp">
<Filter>PowerPC\JitCommon</Filter>
</ClCompile>
Expand Down Expand Up @@ -718,6 +715,7 @@
<ClInclude Include="CoreTiming.h" />
<ClInclude Include="ec_wii.h" />
<ClInclude Include="Host.h" />
<ClCompile Include="MachineContext.h" />
<ClInclude Include="MemTools.h" />
<ClInclude Include="Movie.h" />
<ClInclude Include="NetPlayClient.h" />
Expand Down Expand Up @@ -1176,9 +1174,6 @@
<ClInclude Include="PowerPC\JitCommon\JitAsmCommon.h">
<Filter>PowerPC\JitCommon</Filter>
</ClInclude>
<ClInclude Include="PowerPC\JitCommon\JitBackpatch.h">
<Filter>PowerPC\JitCommon</Filter>
</ClInclude>
<ClInclude Include="PowerPC\JitCommon\JitBase.h">
<Filter>PowerPC\JitCommon</Filter>
</ClInclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,24 @@
#define CTX_RIP __ss.__rip
#elif defined(__linux__)
#include <signal.h>
#if _M_X86_64

#ifdef ANDROID
#include <asm/sigcontext.h>
typedef struct sigcontext mcontext_t;
typedef struct ucontext
{
uint32_t uc_flags;
struct ucontext* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
// ...
} ucontext_t;

This comment was marked as off-topic.

#else
#include <ucontext.h>
typedef mcontext_t SContext;
#endif
typedef mcontext_t SContext;

#if _M_X86_64
#define CTX_RAX gregs[REG_RAX]
#define CTX_RBX gregs[REG_RBX]
#define CTX_RCX gregs[REG_RCX]
Expand All @@ -108,14 +123,11 @@
#define CTX_R15 gregs[REG_R15]
#define CTX_RIP gregs[REG_RIP]
#elif _M_ARM_64
typedef struct sigcontext SContext;
#define CTX_REG(x) regs[x]
#define CTX_SP sp
#define CTX_PC pc
#elif _M_ARM_32
#include <asm/sigcontext.h>
// Add others if required.
typedef sigcontext SContext;
#define CTX_PC arm_pc
#else
#warning No context definition for OS
Expand Down
15 changes: 12 additions & 3 deletions Source/Core/Core/x64MemTools.cpp → Source/Core/Core/MemTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Common/Thread.h"
#include "Common/x64Analyzer.h"

#include "Core/MachineContext.h"
#include "Core/MemTools.h"
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/JitInterface.h"
Expand All @@ -23,6 +24,8 @@ namespace EMM

#ifdef _WIN32

const bool g_exception_handlers_supported = true;

LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
{
switch (pPtrs->ExceptionRecord->ExceptionCode)
Expand Down Expand Up @@ -91,6 +94,8 @@ void UninstallExceptionHandler() {}

#elif defined(__APPLE__) && !defined(USE_SIGACTION_ON_APPLE)

const bool g_exception_handlers_supported = true;

static void CheckKR(const char* name, kern_return_t kr)
{
if (kr)
Expand Down Expand Up @@ -209,7 +214,9 @@ void InstallExceptionHandler()

void UninstallExceptionHandler() {}

#elif defined(_POSIX_VERSION)
#elif defined(_POSIX_VERSION) && !defined(_M_GENERIC)

const bool g_exception_handlers_supported = true;

static void sigsegv_handler(int sig, siginfo_t *info, void *raw_context)
{
Expand Down Expand Up @@ -275,9 +282,11 @@ void UninstallExceptionHandler()
free(old_stack.ss_sp);
}
}
#else
#else // _M_GENERIC or unsupported platform

#error Unsupported x86_64 platform! Report this if you support sigaction
const bool g_exception_handlers_supported = false;
void InstallExceptionHandler() {}
void UninstallExceptionHandler() {}

#endif

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/MemTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace EMM
{
typedef u32 EAddr;
extern const bool g_exception_handlers_supported;

This comment was marked as off-topic.

This comment was marked as off-topic.

void InstallExceptionHandler();
void UninstallExceptionHandler();
}
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "Core/PowerPC/Jit64/JitAsm.h"
#include "Core/PowerPC/Jit64/JitRegCache.h"
#include "Core/PowerPC/JitCommon/Jit_Util.h"
#include "Core/PowerPC/JitCommon/JitBackpatch.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/JitCommon/JitCache.h"

Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/Jit64IL/JitIL.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/Jit64/JitAsm.h"
#include "Core/PowerPC/JitCommon/Jit_Util.h"
#include "Core/PowerPC/JitCommon/JitBackpatch.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/JitCommon/JitCache.h"
#include "Core/PowerPC/JitILCommon/IR.h"
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "Core/HW/Memmap.h"
#include "Core/PowerPC/JitArm32/Jit.h"
#include "Core/PowerPC/JitCommon/JitBackpatch.h"

using namespace ArmGen;

Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "disasm.h"

#include "Core/PowerPC/JitCommon/JitBackpatch.h"
#include "Core/PowerPC/JitCommon/JitBase.h"

using namespace Gen;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitCommon/JitBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "Core/Core.h"
#include "Core/CoreTiming.h"
#include "Core/MachineContext.h"
#include "Core/HW/GPFifo.h"
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/CPUCoreBase.h"
Expand All @@ -24,7 +25,6 @@
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/JitCommon/Jit_Util.h"
#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
#include "Core/PowerPC/JitCommon/JitBackpatch.h"
#include "Core/PowerPC/JitCommon/JitCache.h"
#include "Core/PowerPC/JitCommon/TrampolineCache.h"

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include <string>
#include "Common/ChunkFile.h"
#include "Core/MachineContext.h"
#include "Core/PowerPC/CPUCoreBase.h"
#include "Core/PowerPC/JitCommon/JitBackpatch.h"

namespace JitInterface
{
Expand Down