diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/x64/xbyak_abi.h | 36 | ||||
| -rw-r--r-- | src/video_core/macro/macro_jit_x64.cpp | 12 |
2 files changed, 6 insertions, 42 deletions
diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h index d15e1aaf0..1dcd147b6 100644 --- a/src/common/x64/xbyak_abi.h +++ b/src/common/x64/xbyak_abi.h | |||
| @@ -223,40 +223,4 @@ inline void ABI_PopRegistersAndAdjustStack(Xbyak::CodeGenerator& code, std::bits | |||
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | inline size_t ABI_PushRegistersAndAdjustStackGPS(Xbyak::CodeGenerator& code, std::bitset<32> regs, | ||
| 227 | size_t rsp_alignment, | ||
| 228 | size_t needed_frame_size = 0) { | ||
| 229 | s32 subtraction, xmm_offset; | ||
| 230 | ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size, &subtraction, &xmm_offset); | ||
| 231 | |||
| 232 | for (std::size_t i = 0; i < regs.size(); ++i) { | ||
| 233 | if (regs[i] && ABI_ALL_GPRS[i]) { | ||
| 234 | code.push(IndexToReg64(static_cast<int>(i))); | ||
| 235 | } | ||
| 236 | } | ||
| 237 | |||
| 238 | if (subtraction != 0) { | ||
| 239 | code.sub(code.rsp, subtraction); | ||
| 240 | } | ||
| 241 | |||
| 242 | return ABI_SHADOW_SPACE; | ||
| 243 | } | ||
| 244 | |||
| 245 | inline void ABI_PopRegistersAndAdjustStackGPS(Xbyak::CodeGenerator& code, std::bitset<32> regs, | ||
| 246 | size_t rsp_alignment, size_t needed_frame_size = 0) { | ||
| 247 | s32 subtraction, xmm_offset; | ||
| 248 | ABI_CalculateFrameSize(regs, rsp_alignment, needed_frame_size, &subtraction, &xmm_offset); | ||
| 249 | |||
| 250 | if (subtraction != 0) { | ||
| 251 | code.add(code.rsp, subtraction); | ||
| 252 | } | ||
| 253 | |||
| 254 | // GPRs need to be popped in reverse order | ||
| 255 | for (int i = 15; i >= 0; i--) { | ||
| 256 | if (regs[i]) { | ||
| 257 | code.pop(IndexToReg64(i)); | ||
| 258 | } | ||
| 259 | } | ||
| 260 | } | ||
| 261 | |||
| 262 | } // namespace Common::X64 | 226 | } // namespace Common::X64 |
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp index 11c1cc3be..2d82c8cff 100644 --- a/src/video_core/macro/macro_jit_x64.cpp +++ b/src/video_core/macro/macro_jit_x64.cpp | |||
| @@ -302,22 +302,22 @@ void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) { | |||
| 302 | sub(result, opcode.immediate * -1); | 302 | sub(result, opcode.immediate * -1); |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| 305 | Common::X64::ABI_PushRegistersAndAdjustStackGPS(*this, PersistentCallerSavedRegs(), 0); | 305 | Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); |
| 306 | mov(Common::X64::ABI_PARAM1, qword[STATE]); | 306 | mov(Common::X64::ABI_PARAM1, qword[STATE]); |
| 307 | mov(Common::X64::ABI_PARAM2, RESULT); | 307 | mov(Common::X64::ABI_PARAM2, RESULT); |
| 308 | Common::X64::CallFarFunction(*this, &Read); | 308 | Common::X64::CallFarFunction(*this, &Read); |
| 309 | Common::X64::ABI_PopRegistersAndAdjustStackGPS(*this, PersistentCallerSavedRegs(), 0); | 309 | Common::X64::ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); |
| 310 | mov(RESULT, Common::X64::ABI_RETURN.cvt32()); | 310 | mov(RESULT, Common::X64::ABI_RETURN.cvt32()); |
| 311 | Compile_ProcessResult(opcode.result_operation, opcode.dst); | 311 | Compile_ProcessResult(opcode.result_operation, opcode.dst); |
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | void Tegra::MacroJITx64Impl::Compile_Send(Xbyak::Reg32 value) { | 314 | void Tegra::MacroJITx64Impl::Compile_Send(Xbyak::Reg32 value) { |
| 315 | Common::X64::ABI_PushRegistersAndAdjustStackGPS(*this, PersistentCallerSavedRegs(), 0); | 315 | Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); |
| 316 | mov(Common::X64::ABI_PARAM1, qword[STATE]); | 316 | mov(Common::X64::ABI_PARAM1, qword[STATE]); |
| 317 | mov(Common::X64::ABI_PARAM2, METHOD_ADDRESS); | 317 | mov(Common::X64::ABI_PARAM2, METHOD_ADDRESS); |
| 318 | mov(Common::X64::ABI_PARAM3, value); | 318 | mov(Common::X64::ABI_PARAM3, value); |
| 319 | Common::X64::CallFarFunction(*this, &Send); | 319 | Common::X64::CallFarFunction(*this, &Send); |
| 320 | Common::X64::ABI_PopRegistersAndAdjustStackGPS(*this, PersistentCallerSavedRegs(), 0); | 320 | Common::X64::ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); |
| 321 | 321 | ||
| 322 | Xbyak::Label dont_process{}; | 322 | Xbyak::Label dont_process{}; |
| 323 | // Get increment | 323 | // Get increment |
| @@ -421,7 +421,7 @@ void MacroJITx64Impl::Compile() { | |||
| 421 | bool keep_executing = true; | 421 | bool keep_executing = true; |
| 422 | labels.fill(Xbyak::Label()); | 422 | labels.fill(Xbyak::Label()); |
| 423 | 423 | ||
| 424 | Common::X64::ABI_PushRegistersAndAdjustStackGPS(*this, Common::X64::ABI_ALL_CALLEE_SAVED, 8); | 424 | Common::X64::ABI_PushRegistersAndAdjustStack(*this, Common::X64::ABI_ALL_CALLEE_SAVED, 8); |
| 425 | // JIT state | 425 | // JIT state |
| 426 | mov(STATE, Common::X64::ABI_PARAM1); | 426 | mov(STATE, Common::X64::ABI_PARAM1); |
| 427 | mov(PARAMETERS, qword[Common::X64::ABI_PARAM1 + | 427 | mov(PARAMETERS, qword[Common::X64::ABI_PARAM1 + |
| @@ -463,7 +463,7 @@ void MacroJITx64Impl::Compile() { | |||
| 463 | 463 | ||
| 464 | L(end_of_code); | 464 | L(end_of_code); |
| 465 | 465 | ||
| 466 | Common::X64::ABI_PopRegistersAndAdjustStackGPS(*this, Common::X64::ABI_ALL_CALLEE_SAVED, 8); | 466 | Common::X64::ABI_PopRegistersAndAdjustStack(*this, Common::X64::ABI_ALL_CALLEE_SAVED, 8); |
| 467 | ret(); | 467 | ret(); |
| 468 | ready(); | 468 | ready(); |
| 469 | program = getCode<ProgramType>(); | 469 | program = getCode<ProgramType>(); |