summaryrefslogtreecommitdiffstats
path: root/src/video_core/macro/macro_jit_x64.cpp
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2020-06-15 21:03:32 +0200
committerMerryMage <MerryMage@users.noreply.github.com>2020-06-17 18:17:08 +0200
commit44f10d9b9f4ac6fb718718a85a5916721e7944e4 (patch)
tree47d821ca6d98a0b8edcb0db01c4e99a48692dfc7 /src/video_core/macro/macro_jit_x64.cpp
parentMerge pull request #4086 from MerryMage/abi (diff)
downloadyuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.gz
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.bz2
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.lz
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.xz
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.zst
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.zip
Diffstat (limited to 'src/video_core/macro/macro_jit_x64.cpp')
-rw-r--r--src/video_core/macro/macro_jit_x64.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp
index d4a97ec7b..0b2918388 100644
--- a/src/video_core/macro/macro_jit_x64.cpp
+++ b/src/video_core/macro/macro_jit_x64.cpp
@@ -295,12 +295,20 @@ void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) {
sub(result, opcode.immediate * -1);
}
}
- Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
- mov(Common::X64::ABI_PARAM1, qword[STATE]);
- mov(Common::X64::ABI_PARAM2, RESULT);
- Common::X64::CallFarFunction(*this, &Read);
- Common::X64::ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
- mov(RESULT, Common::X64::ABI_RETURN.cvt32());
+
+ // Equivalent to Engines::Maxwell3D::GetRegisterValue:
+ if (optimizer.enable_asserts) {
+ Xbyak::Label pass_range_check;
+ cmp(RESULT, static_cast<u32>(Engines::Maxwell3D::Regs::NUM_REGS));
+ jb(pass_range_check);
+ int3();
+ L(pass_range_check);
+ }
+ mov(rax, qword[STATE]);
+ mov(RESULT,
+ dword[rax + offsetof(Engines::Maxwell3D, regs) +
+ offsetof(Engines::Maxwell3D::Regs, reg_array) + RESULT.cvt64() * sizeof(u32)]);
+
Compile_ProcessResult(opcode.result_operation, opcode.dst);
}
@@ -435,6 +443,9 @@ void MacroJITx64Impl::Compile() {
// one if our register isn't "dirty"
optimizer.optimize_for_method_move = true;
+ // Enable run-time assertions in JITted code
+ optimizer.enable_asserts = false;
+
// Check to see if we can skip emitting certain instructions
Optimizer_ScanFlags();