mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-09-10 17:16:47 -04:00
add linux option for guest memory usage
This commit is contained in:
@@ -73,8 +73,12 @@ FaultCounters Counters();
|
||||
void LogFaultSummary() noexcept;
|
||||
|
||||
// Returns true when the access violation was a guest-space fault this module
|
||||
// resolved; the caller must then resume execution. `exceptionPointers` is a
|
||||
// Windows EXCEPTION_POINTERS*.
|
||||
bool HandleAccessViolation(void* exceptionPointers) noexcept;
|
||||
// resolved; the caller must then resume execution. `faultAddress` is the raw
|
||||
// host pointer the access violation trapped on (Windows: ExceptionInformation[1];
|
||||
// POSIX: siginfo_t::si_addr) and `isWrite` is whether it was a write access
|
||||
// (Windows: ExceptionInformation[0] != 0; POSIX: derived from the ucontext).
|
||||
// The platform-specific handler that calls this is expected to have already
|
||||
// done that extraction - this function only ever works with the parsed pair.
|
||||
bool HandleAccessViolation(void* faultAddress, bool isWrite) noexcept;
|
||||
|
||||
} // namespace GuestFlat
|
||||
|
||||
@@ -11,10 +11,23 @@
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
// Windows' SehLogger longjmps out of a vectored exception handler, where plain setjmp/longjmp is
|
||||
// the norm. A POSIX signal handler jumping back to here must use the sig-prefixed pair instead:
|
||||
// only sigsetjmp/siglongjmp save and restore the process signal mask, which is what keeps SIGSEGV
|
||||
// from staying blocked (and a second fault during the same ctor loop from escalating instead of
|
||||
// trapping) after the first recovered fault.
|
||||
#if defined(_WIN32)
|
||||
using MkwJmpBuf = jmp_buf;
|
||||
#define MKW_SETJMP(buf) setjmp(buf)
|
||||
#else
|
||||
using MkwJmpBuf = sigjmp_buf;
|
||||
#define MKW_SETJMP(buf) sigsetjmp(buf, 1)
|
||||
#endif
|
||||
|
||||
// Global flag to suppress SEH reporting (caught by system_bridge)
|
||||
extern bool g_suppressSehReporting;
|
||||
// Jump buffer for SEH recovery
|
||||
extern thread_local jmp_buf* g_sehJumpTarget;
|
||||
extern thread_local MkwJmpBuf* g_sehJumpTarget;
|
||||
// SEH details for the most recent trapped exception (used during ctor execution).
|
||||
extern thread_local uint32_t g_sehLastExceptionCode;
|
||||
extern thread_local uintptr_t g_sehLastExceptionAddress;
|
||||
|
||||
Reference in New Issue
Block a user