Skip to content

Commit

Permalink
Update header files
Browse files Browse the repository at this point in the history
  • Loading branch information
987123879113 committed Jan 4, 2025
1 parent f0e0561 commit 5fc82fb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
19 changes: 10 additions & 9 deletions src/devices/cpu/drcbearm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace drc {

class drcbe_arm64 : public drcbe_interface
{
typedef uint32_t (*arm64_entry_point_func)(void *entry);
using arm64_entry_point_func = uint32_t (*)(void *entry);

public:
drcbe_arm64(drcuml_state &drcuml, device_t &device, drc_cache &cache, uint32_t flags, int modes, int addrbits, int ignorebits);
Expand All @@ -34,7 +34,7 @@ class drcbe_arm64 : public drcbe_interface
private:
class be_parameter
{
static int const REG_MAX = 30;
static inline constexpr int REG_MAX = 30;

public:
// parameter types
Expand All @@ -51,14 +51,14 @@ class drcbe_arm64 : public drcbe_interface
typedef uint64_t be_parameter_value;

be_parameter() : m_type(PTYPE_NONE), m_value(0) { }
be_parameter(const be_parameter &param) : m_type(param.m_type), m_value(param.m_value) { }
be_parameter(uint64_t val) : m_type(PTYPE_IMMEDIATE), m_value(val) { }
be_parameter(drcbe_arm64 &drcbe, const uml::parameter &param, uint32_t allowed);
be_parameter(const be_parameter &param) = default;

static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
static be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }

bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
bool operator!=(const be_parameter &rhs) const { return (m_type != rhs.m_type || m_value != rhs.m_value); }
Expand All @@ -76,13 +76,14 @@ class drcbe_arm64 : public drcbe_interface

bool is_immediate_value(uint64_t value) const { return (m_type == PTYPE_IMMEDIATE && m_value == value); }

be_parameter(be_parameter_type type, be_parameter_value value) : m_type(type), m_value(value) { }

asmjit::a64::Vec get_register_float(uint32_t regsize) const;
asmjit::a64::Gp get_register_int(uint32_t regsize) const;
asmjit::a64::Vec select_register(asmjit::a64::Vec const &reg, uint32_t regsize) const;
asmjit::a64::Gp select_register(asmjit::a64::Gp const &reg, uint32_t regsize) const;

private:
be_parameter(be_parameter_type type, be_parameter_value value) : m_type(type), m_value(value) { }

be_parameter_type m_type;
be_parameter_value m_value;
};
Expand Down
14 changes: 7 additions & 7 deletions src/devices/cpu/drcbex64.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace drc {

class drcbe_x64 : public drcbe_interface
{
typedef uint32_t (*x86_entry_point_func)(uint8_t *rbpvalue, x86code *entry);
using x86_entry_point_func = uint32_t (*)(uint8_t *rbpvalue, x86code *entry);

public:
// construction/destruction
Expand All @@ -50,7 +50,7 @@ class drcbe_x64 : public drcbe_interface
{
public:
// HACK: leftover from x86emit
static int const REG_MAX = 16;
static inline constexpr int REG_MAX = 16;

// parameter types
enum be_parameter_type
Expand All @@ -68,15 +68,15 @@ class drcbe_x64 : public drcbe_interface

// construction
be_parameter() : m_type(PTYPE_NONE), m_value(0) { }
be_parameter(be_parameter const &param) : m_type(param.m_type), m_value(param.m_value) { }
be_parameter(uint64_t val) : m_type(PTYPE_IMMEDIATE), m_value(val) { }
be_parameter(drcbe_x64 &drcbe, const uml::parameter &param, uint32_t allowed);
be_parameter(const be_parameter &param) = default;

// creators for types that don't safely default
static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
static be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }

// operators
bool operator==(be_parameter const &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
Expand Down
14 changes: 7 additions & 7 deletions src/devices/cpu/drcbex86.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace drc {

class drcbe_x86 : public drcbe_interface
{
typedef uint32_t (*x86_entry_point_func)(x86code *entry);
using x86_entry_point_func = uint32_t (*)(x86code *entry);

public:
// construction/destruction
Expand All @@ -45,7 +45,7 @@ class drcbe_x86 : public drcbe_interface

private:
// HACK: leftover from x86emit
static int const REG_MAX = 16;
static inline constexpr int REG_MAX = 16;

// a be_parameter is similar to a uml::parameter but maps to native registers/memory
class be_parameter
Expand All @@ -67,15 +67,15 @@ class drcbe_x86 : public drcbe_interface

// construction
be_parameter() : m_type(PTYPE_NONE), m_value(0) { }
be_parameter(be_parameter const &param) : m_type(param.m_type), m_value(param.m_value) { }
be_parameter(uint64_t val) : m_type(PTYPE_IMMEDIATE), m_value(val) { }
be_parameter(drcbe_x86 &drcbe, const uml::parameter &param, uint32_t allowed);
be_parameter(const be_parameter &param) = default;

// creators for types that don't safely default
static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
static be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }

// operators
bool operator==(be_parameter const &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
Expand Down

0 comments on commit 5fc82fb

Please sign in to comment.