9#if defined(__arm64__) || defined(__aarch64__)
11#ifndef lldb_NativeRegisterContextLinux_arm64_h
12#define lldb_NativeRegisterContextLinux_arm64_h
19#include <asm/ptrace.h>
22namespace process_linux {
24class NativeProcessLinux;
26class NativeRegisterContextLinux_arm64
27 :
public NativeRegisterContextLinux,
28 public NativeRegisterContextDBReg_arm64 {
30 NativeRegisterContextLinux_arm64(
31 const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
32 std::unique_ptr<RegisterInfoPOSIX_arm64> register_info_up);
34 uint32_t GetRegisterSetCount()
const override;
36 uint32_t GetUserRegisterCount()
const override;
38 const RegisterSet *GetRegisterSet(uint32_t set_index)
const override;
40 Status ReadRegister(
const RegisterInfo *reg_info,
41 RegisterValue ®_value)
override;
43 Status WriteRegister(
const RegisterInfo *reg_info,
44 const RegisterValue ®_value)
override;
50 void InvalidateAllRegisters()
override;
53 GetExpeditedRegisters(ExpeditedRegs expType)
const override;
55 bool RegisterOffsetIsDynamic()
const override {
return true; }
57 llvm::Expected<MemoryTaggingDetails>
58 GetMemoryTaggingDetails(int32_t type)
override;
63 Status WriteGPR()
override;
67 Status WriteFPR()
override;
69 void *GetGPRBuffer()
override {
return &m_gpr_arm64; }
73 size_t GetGPRBufferSize() {
return sizeof(m_gpr_arm64); }
75 void *GetFPRBuffer()
override {
return &m_fpr; }
77 size_t GetFPRSize()
override {
return sizeof(m_fpr); }
84 bool m_sve_buffer_is_valid;
85 bool m_mte_ctrl_is_valid;
86 bool m_zt_buffer_is_valid;
88 bool m_sve_header_is_valid;
89 bool m_za_buffer_is_valid;
90 bool m_za_header_is_valid;
91 bool m_pac_mask_is_valid;
95 struct user_pt_regs m_gpr_arm64;
100 SVEState m_sve_state = SVEState::Unknown;
101 struct sve::user_sve_header m_sve_header;
102 std::vector<uint8_t> m_sve_ptrace_payload;
104 sve::user_za_header m_za_header;
105 std::vector<uint8_t> m_za_ptrace_payload;
107 bool m_refresh_hwdebug_info;
109 struct user_pac_mask {
114 struct user_pac_mask m_pac_mask;
116 uint64_t m_mte_ctrl_reg;
118 struct sme_pseudo_regs {
123 struct sme_pseudo_regs m_sme_pseudo_regs;
131 struct tls_regs m_tls_regs;
134 std::array<uint8_t, 64> m_zt_reg;
136 bool IsGPR(
unsigned reg)
const;
138 bool IsFPR(
unsigned reg)
const;
177 bool IsSVE(
unsigned reg)
const;
178 bool IsSME(
unsigned reg)
const;
179 bool IsPAuth(
unsigned reg)
const;
180 bool IsMTE(
unsigned reg)
const;
181 bool IsTLS(
unsigned reg)
const;
183 uint64_t GetSVERegVG() {
return m_sve_header.vl / 8; }
185 void SetSVERegVG(uint64_t vg) { m_sve_header.vl =
vg * 8; }
187 void *GetSVEHeader() {
return &m_sve_header; }
189 void *GetZAHeader() {
return &m_za_header; }
191 size_t GetZAHeaderSize() {
return sizeof(m_za_header); }
193 void *GetPACMask() {
return &m_pac_mask; }
195 void *GetMTEControl() {
return &m_mte_ctrl_reg; }
197 void *GetTLSBuffer() {
return &m_tls_regs; }
199 void *GetSMEPseudoBuffer() {
return &m_sme_pseudo_regs; }
201 void *GetZTBuffer() {
return m_zt_reg.data(); }
203 void *GetSVEBuffer() {
return m_sve_ptrace_payload.data(); }
205 size_t GetSVEHeaderSize() {
return sizeof(m_sve_header); }
207 size_t GetPACMaskSize() {
return sizeof(m_pac_mask); }
209 size_t GetSVEBufferSize() {
return m_sve_ptrace_payload.size(); }
211 unsigned GetSVERegSet();
213 void *GetZABuffer() {
return m_za_ptrace_payload.data(); };
215 size_t GetZABufferSize() {
return m_za_ptrace_payload.size(); }
217 size_t GetMTEControlSize() {
return sizeof(m_mte_ctrl_reg); }
219 size_t GetTLSBufferSize() {
return m_tls_size; }
221 size_t GetSMEPseudoBufferSize() {
return sizeof(m_sme_pseudo_regs); }
223 size_t GetZTBufferSize() {
return m_zt_reg.size(); }
225 llvm::Error ReadHardwareDebugInfo()
override;
227 llvm::Error WriteHardwareDebugRegs(DREGType hwbType)
override;
229 uint32_t CalculateFprOffset(
const RegisterInfo *reg_info)
const;
233 void ConfigureRegisterContext();
235 uint32_t CalculateSVEOffset(
const RegisterInfo *reg_info)
const;
237 Status CacheAllRegisters(uint32_t &cached_size);
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP