mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 16:02:26 +00:00
Fixup signal context functions
This commit is contained in:
parent
75ce77468b
commit
7037924a3a
@ -54,20 +54,22 @@ void* GetXmmPointer(void* ctx, u8 index) {
|
|||||||
|
|
||||||
void* GetRip(void* ctx) {
|
void* GetRip(void* ctx) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
return &((EXCEPTION_POINTERS*)ctx)->ContextRecord->Rip;
|
return (void*)((EXCEPTION_POINTERS*)ctx)->ContextRecord->Rip;
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
return &((ucontext_t*)ctx)->uc_mcontext->__ss.__rip;
|
return (void*)((ucontext_t*)ctx)->uc_mcontext->__ss.__rip;
|
||||||
#else
|
#else
|
||||||
return &((ucontext_t*)ctx)->uc_mcontext.gregs[REG_RIP];
|
return (void*)((ucontext_t*)ctx)->uc_mcontext.gregs[REG_RIP];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncrementRip(void* ctx, u64 length) {
|
void IncrementRip(void* ctx, u64 length) {
|
||||||
void* rip = GetRip(ctx);
|
#if defined(_WIN32)
|
||||||
u64 new_rip;
|
((EXCEPTION_POINTERS*)ctx)->ContextRecord->Rip += length;
|
||||||
memcpy(&new_rip, rip, sizeof(u64));
|
#elif defined(__APPLE__)
|
||||||
new_rip += length;
|
((ucontext_t*)ctx)->uc_mcontext->__ss.__rip += length;
|
||||||
memcpy(rip, &new_rip, sizeof(u64));
|
#else
|
||||||
|
((ucontext_t*)ctx)->uc_mcontext.gregs[REG_RIP] += length;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsWriteError(void* ctx) {
|
bool IsWriteError(void* ctx) {
|
||||||
|
@ -153,9 +153,9 @@ struct PageManager::Impl {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GuestFaultSignalHandler(void* code_address, void* fault_address) {
|
static bool GuestFaultSignalHandler(void* context, void* fault_address) {
|
||||||
const auto addr = reinterpret_cast<VAddr>(fault_address);
|
const auto addr = reinterpret_cast<VAddr>(fault_address);
|
||||||
const bool is_write = Common::IsWriteError(code_address);
|
const bool is_write = Common::IsWriteError(context);
|
||||||
if (is_write && owned_ranges.find(addr) != owned_ranges.end()) {
|
if (is_write && owned_ranges.find(addr) != owned_ranges.end()) {
|
||||||
const VAddr addr_aligned = Common::AlignDown(addr, PAGESIZE);
|
const VAddr addr_aligned = Common::AlignDown(addr, PAGESIZE);
|
||||||
rasterizer->InvalidateMemory(addr_aligned, PAGESIZE);
|
rasterizer->InvalidateMemory(addr_aligned, PAGESIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user