From 3fe45c6d8ee69b979a18021be292d5384d7e8e51 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 25 Jul 2018 13:58:54 +0100 Subject: [PATCH] block_of_code: Add ABI_PARAMS array --- src/backend_x64/block_of_code.cpp | 3 +++ src/backend_x64/block_of_code.h | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/backend_x64/block_of_code.cpp b/src/backend_x64/block_of_code.cpp index 0d31966b..dd9e650b 100644 --- a/src/backend_x64/block_of_code.cpp +++ b/src/backend_x64/block_of_code.cpp @@ -4,6 +4,7 @@ * General Public License version 2 or any later version. */ +#include #include #include @@ -22,6 +23,7 @@ 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; +const std::array BlockOfCode::ABI_PARAMS = {BlockOfCode::ABI_PARAM1, BlockOfCode::ABI_PARAM2, BlockOfCode::ABI_PARAM3, BlockOfCode::ABI_PARAM4}; #else const Xbyak::Reg64 BlockOfCode::ABI_RETURN = Xbyak::util::rax; const Xbyak::Reg64 BlockOfCode::ABI_RETURN2 = Xbyak::util::rdx; @@ -31,6 +33,7 @@ const Xbyak::Reg64 BlockOfCode::ABI_PARAM3 = Xbyak::util::rdx; const Xbyak::Reg64 BlockOfCode::ABI_PARAM4 = Xbyak::util::rcx; const Xbyak::Reg64 BlockOfCode::ABI_PARAM5 = Xbyak::util::r8; const Xbyak::Reg64 BlockOfCode::ABI_PARAM6 = Xbyak::util::r9; +const std::array BlockOfCode::ABI_PARAMS = {BlockOfCode::ABI_PARAM1, BlockOfCode::ABI_PARAM2, BlockOfCode::ABI_PARAM3, BlockOfCode::ABI_PARAM4, BlockOfCode::ABI_PARAM5, BlockOfCode::ABI_PARAM6}; #endif constexpr size_t TOTAL_CODE_SIZE = 128 * 1024 * 1024; diff --git a/src/backend_x64/block_of_code.h b/src/backend_x64/block_of_code.h index 7164dc5b..64bae281 100644 --- a/src/backend_x64/block_of_code.h +++ b/src/backend_x64/block_of_code.h @@ -100,17 +100,24 @@ public: void SetCodePtr(CodePtr code_ptr); void EnsurePatchLocationSize(CodePtr begin, size_t size); + // ABI registers +#ifdef _WIN32 static const Xbyak::Reg64 ABI_RETURN; -#ifndef _WIN32 - static const Xbyak::Reg64 ABI_RETURN2; -#endif static const Xbyak::Reg64 ABI_PARAM1; static const Xbyak::Reg64 ABI_PARAM2; static const Xbyak::Reg64 ABI_PARAM3; static const Xbyak::Reg64 ABI_PARAM4; -#ifndef _WIN32 + static const std::array ABI_PARAMS; +#else + static const Xbyak::Reg64 ABI_RETURN; + static const Xbyak::Reg64 ABI_RETURN2; + static const Xbyak::Reg64 ABI_PARAM1; + static const Xbyak::Reg64 ABI_PARAM2; + static const Xbyak::Reg64 ABI_PARAM3; + static const Xbyak::Reg64 ABI_PARAM4; static const Xbyak::Reg64 ABI_PARAM5; static const Xbyak::Reg64 ABI_PARAM6; + static const std::array ABI_PARAMS; #endif bool DoesCpuSupport(Xbyak::util::Cpu::Type type) const;