diff --git a/src/backend_x64/block_of_code.cpp b/src/backend_x64/block_of_code.cpp index 73a381b7..53dc448e 100644 --- a/src/backend_x64/block_of_code.cpp +++ b/src/backend_x64/block_of_code.cpp @@ -18,6 +18,20 @@ namespace Dynarmic { namespace BackendX64 { +#ifdef _WIN32 +const Xbyak::Reg64 BlockOfCode::ABI_RETURN = Xbyak::util::rax; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM1 = Xbyak::util::rcx; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM2 = Xbyak::util::rdx; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM3 = Xbyak::util::r8; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM4 = Xbyak::util::r9; +#else +const Xbyak::Reg64 BlockOfCode::ABI_RETURN = Xbyak::util::rax; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM1 = Xbyak::util::rdi; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM2 = Xbyak::util::rsi; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM3 = Xbyak::util::rdx; +const Xbyak::Reg64 BlockOfCode::ABI_PARAM4 = Xbyak::util::rcx; +#endif + constexpr size_t TOTAL_CODE_SIZE = 128 * 1024 * 1024; constexpr size_t FAR_CODE_OFFSET = 100 * 1024 * 1024; diff --git a/src/backend_x64/block_of_code.h b/src/backend_x64/block_of_code.h index f0b16f64..3a986bb7 100644 --- a/src/backend_x64/block_of_code.h +++ b/src/backend_x64/block_of_code.h @@ -112,19 +112,11 @@ public: void SetCodePtr(CodePtr code_ptr); void EnsurePatchLocationSize(CodePtr begin, size_t size); -#ifdef _WIN32 - Xbyak::Reg64 ABI_RETURN = rax; - Xbyak::Reg64 ABI_PARAM1 = rcx; - Xbyak::Reg64 ABI_PARAM2 = rdx; - Xbyak::Reg64 ABI_PARAM3 = r8; - Xbyak::Reg64 ABI_PARAM4 = r9; -#else - Xbyak::Reg64 ABI_RETURN = rax; - Xbyak::Reg64 ABI_PARAM1 = rdi; - Xbyak::Reg64 ABI_PARAM2 = rsi; - Xbyak::Reg64 ABI_PARAM3 = rdx; - Xbyak::Reg64 ABI_PARAM4 = rcx; -#endif + static const Xbyak::Reg64 ABI_RETURN; + static const Xbyak::Reg64 ABI_PARAM1; + static const Xbyak::Reg64 ABI_PARAM2; + static const Xbyak::Reg64 ABI_PARAM3; + static const Xbyak::Reg64 ABI_PARAM4; private: UserCallbacks cb;