mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
vm::g_exec_addr added
s_ppu_compiled renamed Exception handling enabled
This commit is contained in:
parent
e4d1bdef07
commit
37a97a71e3
5 changed files with 62 additions and 29 deletions
|
@ -1229,7 +1229,8 @@ static bool is_leaf_function(u64 rip)
|
|||
|
||||
static LONG exception_handler(PEXCEPTION_POINTERS pExp)
|
||||
{
|
||||
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::base(0);
|
||||
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_base_addr;
|
||||
const u64 exec64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_exec_addr;
|
||||
const bool is_writing = pExp->ExceptionRecord->ExceptionInformation[0] != 0;
|
||||
|
||||
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && addr64 < 0x100000000ull)
|
||||
|
@ -1240,6 +1241,14 @@ static LONG exception_handler(PEXCEPTION_POINTERS pExp)
|
|||
}
|
||||
}
|
||||
|
||||
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && exec64 < 0x100000000ull)
|
||||
{
|
||||
if (thread_ctrl::get_current() && handle_access_violation((u32)exec64, is_writing, pExp->ContextRecord))
|
||||
{
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
}
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1258,6 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp)
|
|||
|
||||
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
|
||||
{
|
||||
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::base(0);
|
||||
const auto cause = pExp->ExceptionRecord->ExceptionInformation[0] != 0 ? "writing" : "reading";
|
||||
|
||||
msg += fmt::format("Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress);
|
||||
|
@ -1360,7 +1368,8 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
|
|||
const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2;
|
||||
#endif
|
||||
|
||||
const u64 addr64 = (u64)info->si_addr - (u64)vm::base(0);
|
||||
const u64 addr64 = (u64)info->si_addr - (u64)vm::g_base_addr;
|
||||
const u64 exec64 = (u64)info->si_addr - (u64)vm::g_exec_addr;
|
||||
const auto cause = is_writing ? "writing" : "reading";
|
||||
|
||||
if (addr64 < 0x100000000ull)
|
||||
|
@ -1372,6 +1381,14 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
|
|||
}
|
||||
}
|
||||
|
||||
if (exec64 < 0x100000000ull)
|
||||
{
|
||||
if (thread_ctrl::get_current() && handle_access_violation((u32)exec64, is_writing, context))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO (debugger interaction)
|
||||
report_fatal_error(fmt::format("Segfault %s location %p at %p.", cause, info->si_addr, RIP(context)));
|
||||
std::abort();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue