mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 08:13:05 +00:00
shader: complete faulting SRT walker loads as zero reads
This commit is contained in:
1 parent
f356fa3730
commit
bdf48dcf3b
6 files changed
+72
-6
No files matched your search
@@ -14,6 +14,7 @@
|
||||
#include "common/threads.h"
|
||||
#include "common/virtualMemory.h"
|
||||
#include "graphics/host_gpu/pageManager.h"
|
||||
#include "graphics/shader/recompiler/ir/passes/SrtWalker.h"
|
||||
#include "kernel/fileSystem.h"
|
||||
#include "kernel/memory.h"
|
||||
#include "kernel/pthread.h"
|
||||
@@ -672,6 +673,11 @@ static bool KytyExceptionHandler(const Common::HostException::ExceptionInfo& exc
|
||||
Common::DebugCounters::Add(Common::DebugCounters::Counter::GpuFaults);
|
||||
return true;
|
||||
}
|
||||
if (const auto length =
|
||||
Libs::Graphics::ShaderRecompiler::IR::SrtWalkerLoadLength(info->exception_address)) {
|
||||
Loader::X64InstructionEmulator::SkipLoad(info->native_context, length);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Report whatever guest context can be read safely before terminating: which guest thread
|
||||
// faulted, the register file, the faulting code bytes and the top of its stack.
|
||||
|
||||
@@ -822,4 +822,10 @@ bool TryEmulate(void* native_context) {
|
||||
TryEmulateCpuExtensions(context);
|
||||
}
|
||||
|
||||
void SkipLoad(void* native_context, size_t length) {
|
||||
Context context {static_cast<decltype(Context::native)>(native_context)};
|
||||
context.Gpr(0) = 0;
|
||||
context.Advance(length);
|
||||
}
|
||||
|
||||
} // namespace Loader::X64InstructionEmulator
|
||||
@@ -1,9 +1,13 @@
|
||||
#ifndef KYTY_LOADER_X64_INSTRUCTION_EMULATOR_H_
|
||||
#define KYTY_LOADER_X64_INSTRUCTION_EMULATOR_H_
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Loader::X64InstructionEmulator {
|
||||
|
||||
[[nodiscard]] bool TryEmulate(void* native_context);
|
||||
// Completes a faulting load into EAX as a zero read and resumes after it.
|
||||
void SkipLoad(void* native_context, size_t length);
|
||||
|
||||
} // namespace Loader::X64InstructionEmulator
|
||||
|
||||
|
||||
Reference in new issue
Block a user