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

- Get rid of ArmMemTools.cpp and rename x64MemTools.cpp to MemTools.cpp.
  ArmMemTools was almost identical to the POSIX part of x64MemTools, and
  the two differences, (a) lack of sigaltstack, which I added to the
  latter recently, and (b) use of r10 to determine the fault address
  instead of info->si_addr (meaning it only works for specifically
  formatted JIT code), I don't think are necessary.  (Plus Android, see
  below.)

- Rename Core/PowerPC/JitCommon/JitBackpatch.h to Core/MachineContext.h.
  It doesn't contain anything JIT-specific anymore, and e.g. locking
  will want to use faulting support regardless of whether any JIT is in
  use.

- Get rid of different definitions of SContext for different
  architectures under __linux__, since this is POSIX.  The exception is
  of course Android being shitty; I moved the workaround definition from
  ArmMemTools.cpp to here.

- Get rid of #ifdefs around EMM::InstallExceptionHandler and just
  provide an empty implementation for unsupported systems (i.e.
  _M_GENERIC really).  Added const bool g_exception_handlers_supported
  for future use; currently exception handlers are only used by the JIT,
  whose use implies non-M_GENERIC, but locking will change that.

- Remove an unnecessary typedef.
This commit is contained in:
comex
2014-10-30 23:52:57 -04:00
parent 5ba5aa10e3
commit 2ecd849eab
14 changed files with 37 additions and 108 deletions

View File

@ -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);
@ -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;
}