14#include "llvm/Support/Compiler.h"
19#define GPR_OFFSET(idx) ((idx)*8)
20#define GPR_OFFSET_NAME(reg) \
21 (LLVM_EXTENSION offsetof(RegisterInfoPOSIX_arm64::GPR, reg))
23#define FPU_OFFSET(idx) ((idx)*16 + sizeof(RegisterInfoPOSIX_arm64::GPR))
24#define FPU_OFFSET_NAME(reg) \
25 (LLVM_EXTENSION offsetof(RegisterInfoPOSIX_arm64::FPU, reg) + \
26 sizeof(RegisterInfoPOSIX_arm64::GPR))
33#define SVE_QUAD_WORD_BYTES 16
42#define SVE_REGS_DEFAULT_OFFSET_LINUX sizeof(RegisterInfoPOSIX_arm64::GPR)
44#define SVE_OFFSET_VG SVE_REGS_DEFAULT_OFFSET_LINUX
46#define EXC_OFFSET_NAME(reg) \
47 (LLVM_EXTENSION offsetof(RegisterInfoPOSIX_arm64::EXC, reg) + \
48 sizeof(RegisterInfoPOSIX_arm64::GPR) + \
49 sizeof(RegisterInfoPOSIX_arm64::FPU))
50#define DBG_OFFSET_NAME(reg) \
51 (LLVM_EXTENSION offsetof(RegisterInfoPOSIX_arm64::DBG, reg) + \
52 sizeof(RegisterInfoPOSIX_arm64::GPR) + \
53 sizeof(RegisterInfoPOSIX_arm64::FPU) + \
54 sizeof(RegisterInfoPOSIX_arm64::EXC))
56#define DEFINE_DBG(reg, i) \
58 sizeof(((RegisterInfoPOSIX_arm64::DBG *) NULL)->reg[i]), \
59 DBG_OFFSET_NAME(reg[i]), lldb::eEncodingUint, lldb::eFormatHex, \
60 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
61 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
64#define REG_CONTEXT_SIZE \
65 (sizeof(RegisterInfoPOSIX_arm64::GPR) + \
66 sizeof(RegisterInfoPOSIX_arm64::FPU) + \
67 sizeof(RegisterInfoPOSIX_arm64::EXC))
70#define DECLARE_REGISTER_INFOS_ARM64_STRUCT
73#undef DECLARE_REGISTER_INFOS_ARM64_STRUCT
76 DEFINE_EXTENSION_REG(data_mask), DEFINE_EXTENSION_REG(code_mask)};
79 DEFINE_EXTENSION_REG(mte_ctrl)};
82 DEFINE_EXTENSION_REG(tpidr),
84 DEFINE_EXTENSION_REG(tpidr2)};
87 DEFINE_EXTENSION_REG(svcr),
88 DEFINE_EXTENSION_REG(svg),
91 KIND_ALL_INVALID,
nullptr,
nullptr,
nullptr}};
95 KIND_ALL_INVALID,
nullptr,
nullptr,
nullptr}};
114 gpr_x0, gpr_x1, gpr_x2, gpr_x3,
115 gpr_x4, gpr_x5, gpr_x6, gpr_x7,
116 gpr_x8, gpr_x9, gpr_x10, gpr_x11,
117 gpr_x12, gpr_x13, gpr_x14, gpr_x15,
118 gpr_x16, gpr_x17, gpr_x18, gpr_x19,
119 gpr_x20, gpr_x21, gpr_x22, gpr_x23,
120 gpr_x24, gpr_x25, gpr_x26, gpr_x27,
123 gpr_w2, gpr_w3, gpr_w4, gpr_w5,
124 gpr_w6, gpr_w7, gpr_w8, gpr_w9,
125 gpr_w10, gpr_w11, gpr_w12, gpr_w13,
126 gpr_w14, gpr_w15, gpr_w16, gpr_w17,
127 gpr_w18, gpr_w19, gpr_w20, gpr_w21,
128 gpr_w22, gpr_w23, gpr_w24, gpr_w25,
133 "g_gpr_regnums_arm64 has wrong number of register infos");
137 fpu_v0, fpu_v1, fpu_v2,
138 fpu_v3, fpu_v4, fpu_v5,
139 fpu_v6, fpu_v7, fpu_v8,
140 fpu_v9, fpu_v10, fpu_v11,
141 fpu_v12, fpu_v13, fpu_v14,
142 fpu_v15, fpu_v16, fpu_v17,
143 fpu_v18, fpu_v19, fpu_v20,
144 fpu_v21, fpu_v22, fpu_v23,
145 fpu_v24, fpu_v25, fpu_v26,
146 fpu_v27, fpu_v28, fpu_v29,
159 fpu_d2, fpu_d3, fpu_d4,
160 fpu_d5, fpu_d6, fpu_d7,
161 fpu_d8, fpu_d9, fpu_d10,
162 fpu_d11, fpu_d12, fpu_d13,
163 fpu_d14, fpu_d15, fpu_d16,
164 fpu_d17, fpu_d18, fpu_d19,
165 fpu_d20, fpu_d21, fpu_d22,
166 fpu_d23, fpu_d24, fpu_d25,
167 fpu_d26, fpu_d27, fpu_d28,
168 fpu_d29, fpu_d30, fpu_d31,
172 "g_fpu_regnums_arm64 has wrong number of register infos");
176 sve_vg, sve_z0, sve_z1,
177 sve_z2, sve_z3, sve_z4,
178 sve_z5, sve_z6, sve_z7,
179 sve_z8, sve_z9, sve_z10,
180 sve_z11, sve_z12, sve_z13,
181 sve_z14, sve_z15, sve_z16,
182 sve_z17, sve_z18, sve_z19,
183 sve_z20, sve_z21, sve_z22,
184 sve_z23, sve_z24, sve_z25,
185 sve_z26, sve_z27, sve_z28,
186 sve_z29, sve_z30, sve_z31,
187 sve_p0, sve_p1, sve_p2,
188 sve_p3, sve_p4, sve_p5,
189 sve_p6, sve_p7, sve_p8,
190 sve_p9, sve_p10, sve_p11,
191 sve_p12, sve_p13, sve_p14,
195 "g_sve_regnums_arm64 has wrong number of register infos");
219 :
lldb_private::RegisterInfoAndSetInterface(target_arch),
220 m_opt_regsets(opt_regsets) {
222 case llvm::Triple::aarch64:
223 case llvm::Triple::aarch64_32: {
237 std::make_pair(sve_vg, sve_ffr + 1);
244 llvm::ArrayRef<lldb_private::RegisterInfo> reg_infos_ref =
246 llvm::ArrayRef<lldb_private::RegisterSet> reg_sets_ref =
272 assert(
false &&
"Unhandled target architecture.");
298 uint32_t reg_index)
const {
300 if (reg_index >= regset_range.second.first &&
301 reg_index < regset_range.second.second)
302 return regset_range.first;
342 std::make_pair(mte_regnum, mte_regnum + 1);
349 uint32_t num_regs = has_tpidr2 ? 2 : 1;
350 for (uint32_t i = 0; i < num_regs; i++) {
363 {
"Thread Local Storage Registers",
"tls", num_regs,
nullptr});
369 uint32_t sme_regnum = first_sme_regnum;
405 static uint32_t vg_invalidates[] = {sme_regnum + 1 ,
427 std::vector<lldb_private::RegisterInfo> ®_info_ref =
430 if (reg_info_ref.empty()) {
434 reg_info_ref[fpu_fpsr].byte_offset = offset;
435 reg_info_ref[fpu_fpcr].byte_offset = offset + 4;
436 reg_info_ref[sve_vg].byte_offset = offset + 8;
440 uint32_t s_reg_base =
fpu_s0;
441 uint32_t d_reg_base = fpu_d0;
442 uint32_t v_reg_base = fpu_v0;
443 uint32_t z_reg_base = sve_z0;
445 for (uint32_t index = 0; index < 32; index++) {
446 reg_info_ref[s_reg_base + index].byte_offset = offset;
447 reg_info_ref[d_reg_base + index].byte_offset = offset;
448 reg_info_ref[v_reg_base + index].byte_offset = offset;
449 reg_info_ref[z_reg_base + index].byte_offset = offset;
452 offset += reg_info_ref[z_reg_base + index].byte_size;
456 for (uint32_t it = sve_p0; it <= sve_ffr; it++) {
457 reg_info_ref[it].byte_offset = offset;
459 offset += reg_info_ref[it].byte_size;
463 reg_info_ref[it].byte_offset = offset;
464 offset += reg_info_ref[it].byte_size;
485 (za_vq * 16) * (za_vq * 16);
490 return (sve_vg <= reg && reg <= sve_ffr);
496 return (sve_z0 <= reg && reg <= sve_z31);
500 return (sve_p0 <= reg && reg <= sve_p15);
504 return sve_vg == reg;
static lldb_private::RegisterInfo g_register_infos_tls[]
static const uint32_t g_fpu_regnums_arm64[]
static lldb_private::RegisterInfo g_register_infos_mte[]
#define SVE_QUAD_WORD_BYTES
static const lldb_private::RegisterSet g_reg_set_mte_arm64
static const lldb_private::RegisterSet g_reg_set_pauth_arm64
static const lldb_private::RegisterSet g_reg_set_sme_arm64
#define SVE_REGS_DEFAULT_OFFSET_LINUX
@ k_num_register_sets_default
static const uint32_t g_gpr_regnums_arm64[]
static const uint32_t g_sve_regnums_arm64[]
static const lldb_private::RegisterSet g_reg_sets_arm64[k_num_register_sets]
static lldb_private::RegisterInfo g_register_infos_pauth[]
static lldb_private::RegisterInfo g_register_infos_sme[]
static lldb_private::RegisterInfo g_register_infos_sme2[]
std::map< uint32_t, std::pair< uint32_t, uint32_t > > m_per_regset_regnum_range
static size_t GetGPRSizeStatic()
std::vector< lldb_private::RegisterInfo > m_dynamic_reg_infos
bool IsSVERegVG(unsigned reg) const
lldb_private::Flags m_opt_regsets
bool IsSMERegZT(unsigned reg) const
void AddRegSetTLS(bool has_tpidr2)
const lldb_private::RegisterInfo * m_register_info_p
uint32_t ConfigureVectorLengthSVE(uint32_t sve_vq)
@ eVectorQuadwordAArch64SVE
uint32_t m_register_info_count
std::vector< uint32_t > m_tls_regnum_collection
void ConfigureVectorLengthZA(uint32_t za_vq)
std::vector< lldb_private::RegisterSet > m_dynamic_reg_sets
uint32_t m_register_set_count
uint32_t GetTLSOffset() const
uint32_t GetRegNumSMESVG() const
std::vector< uint32_t > m_mte_regnum_collection
const lldb_private::RegisterInfo * GetRegisterInfo() const override
bool IsSVEZReg(unsigned reg) const
uint32_t GetRegNumFPCR() const
void AddRegSetSME(bool has_zt)
bool IsPAuthReg(unsigned reg) const
uint32_t GetMTEOffset() const
uint32_t GetRegNumSVEZ0() const
bool IsSMERegZA(unsigned reg) const
size_t GetRegisterSetCount() const override
uint32_t GetRegNumFPSR() const
const lldb_private::RegisterSet * m_register_set_p
std::vector< uint32_t > pauth_regnum_collection
bool IsSVEReg(unsigned reg) const
uint32_t GetRegNumSVEVG() const
bool VectorSizeIsValid(uint32_t vq)
bool IsSVEPReg(unsigned reg) const
bool IsTLSReg(unsigned reg) const
bool IsMTEReg(unsigned reg) const
size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override
RegisterInfoPOSIX_arm64(const lldb_private::ArchSpec &target_arch, lldb_private::Flags opt_regsets)
per_vq_register_infos m_per_vq_reg_infos
uint32_t GetRegisterCount() const override
uint32_t GetRegNumSVEFFR() const
size_t GetFPRSize() const override
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) const override
uint32_t GetPAuthOffset() const
std::vector< uint32_t > m_sme_regnum_collection
uint32_t GetSMEOffset() const
bool IsSMEReg(unsigned reg) const
An architecture specification class.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
bool AllSet(ValueType mask) const
Test if all bits in mask are 1 in the current flags.
bool AnySet(ValueType mask) const
Test one or more flags.
#define LLDB_INVALID_REGNUM
A class that represents a running process on the host machine.
@ eEncodingVector
vector registers
@ eRegisterKindLLDB
lldb's internal register numbers
Every register is described in detail including its name, alternate name (optional),...
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.