mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-26 12:04:47 +00:00
clang-format lolz
This commit is contained in:
parent
01ce538cd6
commit
d3f2aedb1e
@ -6,12 +6,12 @@
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <xbyak/xbyak.h>
|
||||
#include <xbyak/xbyak_util.h>
|
||||
#include "core/signals.h"
|
||||
#include "common/config.h"
|
||||
#include "common/io_file.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/path_util.h"
|
||||
#include "common/signal_context.h"
|
||||
#include "core/signals.h"
|
||||
#include "shader_recompiler/info.h"
|
||||
#include "shader_recompiler/ir/breadth_first_search.h"
|
||||
#include "shader_recompiler/ir/opcodes.h"
|
||||
@ -65,13 +65,13 @@ static bool SrtWalkerSignalHandler(void* context, void* fault_address) {
|
||||
if (code < code_start || code >= code_end) {
|
||||
return false; // Not in SRT code range
|
||||
}
|
||||
|
||||
|
||||
// Patch instruction to zero register
|
||||
ZydisDecodedInstruction instruction;
|
||||
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
|
||||
ZyanStatus status = Common::Decoder::Instance()->decodeInstruction(
|
||||
instruction, operands, const_cast<void*>(code), 15);
|
||||
|
||||
ZyanStatus status = Common::Decoder::Instance()->decodeInstruction(instruction, operands,
|
||||
const_cast<void*>(code), 15);
|
||||
|
||||
ASSERT(ZYAN_SUCCESS(status) && instruction.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||||
operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||||
operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY);
|
||||
@ -83,28 +83,28 @@ static bool SrtWalkerSignalHandler(void* context, void* fault_address) {
|
||||
// We can only encounter rdi or r10d as the first operand in a
|
||||
// fault memory access for SRT walker.
|
||||
switch (operands[0].reg.value) {
|
||||
case ZYDIS_REGISTER_RDI:
|
||||
// mov rdi, [rdi + (off_dw << 2)] -> xor rdi, rdi
|
||||
code_patch[0] = 0x48;
|
||||
code_patch[1] = 0x31;
|
||||
code_patch[2] = 0xFF;
|
||||
break;
|
||||
case ZYDIS_REGISTER_R10D:
|
||||
// mov r10d, [rdi + (off_dw << 2)] -> xor r10d, r10d
|
||||
code_patch[0] = 0x45;
|
||||
code_patch[1] = 0x31;
|
||||
code_patch[2] = 0xD2;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unsupported register for SRT walker patch");
|
||||
return false;
|
||||
case ZYDIS_REGISTER_RDI:
|
||||
// mov rdi, [rdi + (off_dw << 2)] -> xor rdi, rdi
|
||||
code_patch[0] = 0x48;
|
||||
code_patch[1] = 0x31;
|
||||
code_patch[2] = 0xFF;
|
||||
break;
|
||||
case ZYDIS_REGISTER_R10D:
|
||||
// mov r10d, [rdi + (off_dw << 2)] -> xor r10d, r10d
|
||||
code_patch[0] = 0x45;
|
||||
code_patch[1] = 0x31;
|
||||
code_patch[2] = 0xD2;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unsupported register for SRT walker patch");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fill nops
|
||||
memset(code_patch + patch_size, 0x90, len - patch_size);
|
||||
|
||||
LOG_WARNING(Render_Recompiler, "Patched SRT walker at {}", code);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user