block_of_code: Add ABI_PARAMS array

This commit is contained in:
MerryMage 2018-07-25 13:58:54 +01:00
parent 642b6c31d2
commit 3fe45c6d8e
2 changed files with 14 additions and 4 deletions

View file

@ -4,6 +4,7 @@
* General Public License version 2 or any later version.
*/
#include <array>
#include <cstring>
#include <limits>
@ -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<Xbyak::Reg64, 4> 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<Xbyak::Reg64, 6> 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;

View file

@ -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<Xbyak::Reg64, 4> 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<Xbyak::Reg64, 6> ABI_PARAMS;
#endif
bool DoesCpuSupport(Xbyak::util::Cpu::Type type) const;