LLDB  mainline
RegisterInfoPOSIX_arm64.h
Go to the documentation of this file.
1 //===-- RegisterInfoPOSIX_arm64.h -------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_ARM64_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_ARM64_H
11 
14 #include "lldb/Utility/Flags.h"
15 #include "lldb/lldb-private.h"
16 #include <map>
17 
18 enum class SVEState { Unknown, Disabled, FPSIMD, Full };
19 
22 public:
23  enum { GPRegSet = 0, FPRegSet };
24 
25  // AArch64 register set mask value
26  enum {
32  };
33 
34  // AArch64 Register set FP/SIMD feature configuration
35  enum {
39  };
40 
41  // based on RegisterContextDarwin_arm64.h
42  LLVM_PACKED_START
43  struct GPR {
44  uint64_t x[29]; // x0-x28
45  uint64_t fp; // x29
46  uint64_t lr; // x30
47  uint64_t sp; // x31
48  uint64_t pc; // pc
49  uint32_t cpsr; // cpsr
50  };
52 
53  // based on RegisterContextDarwin_arm64.h
54  struct VReg {
55  uint8_t bytes[16];
56  };
57 
58  // based on RegisterContextDarwin_arm64.h
59  struct FPU {
60  VReg v[32];
63  };
64 
65  // based on RegisterContextDarwin_arm64.h
66  struct EXC {
67  uint64_t far; // Virtual Fault Address
68  uint32_t esr; // Exception syndrome
69  uint32_t exception; // number of arm exception token
70  };
71 
72  // based on RegisterContextDarwin_arm64.h
73  struct DBG {
74  uint64_t bvr[16];
75  uint64_t bcr[16];
76  uint64_t wvr[16];
77  uint64_t wcr[16];
78  uint64_t mdscr_el1;
79  };
80 
82  lldb_private::Flags opt_regsets);
83 
84  size_t GetGPRSize() const override;
85 
86  size_t GetFPRSize() const override;
87 
88  const lldb_private::RegisterInfo *GetRegisterInfo() const override;
89 
90  uint32_t GetRegisterCount() const override;
91 
92  const lldb_private::RegisterSet *
93  GetRegisterSet(size_t reg_set) const override;
94 
95  size_t GetRegisterSetCount() const override;
96 
97  size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
98 
99  void AddRegSetPAuth();
100 
101  void AddRegSetMTE();
102 
104 
107  return true;
108  return false;
109  }
110 
114 
115  bool IsSVEReg(unsigned reg) const;
116  bool IsSVEZReg(unsigned reg) const;
117  bool IsSVEPReg(unsigned reg) const;
118  bool IsSVERegVG(unsigned reg) const;
119  bool IsPAuthReg(unsigned reg) const;
120  bool IsMTEReg(unsigned reg) const;
121 
122  uint32_t GetRegNumSVEZ0() const;
123  uint32_t GetRegNumSVEFFR() const;
124  uint32_t GetRegNumFPCR() const;
125  uint32_t GetRegNumFPSR() const;
126  uint32_t GetRegNumSVEVG() const;
127  uint32_t GetPAuthOffset() const;
128  uint32_t GetMTEOffset() const;
129 
130 private:
131  typedef std::map<uint32_t, std::vector<lldb_private::RegisterInfo>>
133 
135 
137 
138  const lldb_private::RegisterInfo *m_register_info_p;
140 
141  const lldb_private::RegisterSet *m_register_set_p;
143 
144  // Contains pair of [start, end] register numbers of a register set with start
145  // and end included.
146  std::map<uint32_t, std::pair<uint32_t, uint32_t>> m_per_regset_regnum_range;
147 
149 
150  std::vector<lldb_private::RegisterInfo> m_dynamic_reg_infos;
151  std::vector<lldb_private::RegisterSet> m_dynamic_reg_sets;
152 
153  std::vector<uint32_t> pauth_regnum_collection;
154  std::vector<uint32_t> m_mte_regnum_collection;
155 };
156 
157 #endif
RegisterInfoPOSIX_arm64::GetRegisterInfo
const lldb_private::RegisterInfo * GetRegisterInfo() const override
Definition: RegisterInfoPOSIX_arm64.cpp:251
RegisterInfoPOSIX_arm64::GPRegSet
@ GPRegSet
Definition: RegisterInfoPOSIX_arm64.h:23
RegisterInfoPOSIX_arm64::IsSVEEnabled
bool IsSVEEnabled() const
Definition: RegisterInfoPOSIX_arm64.h:111
RegisterInfoPOSIX_arm64::eRegsetMaskSVE
@ eRegsetMaskSVE
Definition: RegisterInfoPOSIX_arm64.h:28
RegisterInfoPOSIX_arm64::m_dynamic_reg_sets
std::vector< lldb_private::RegisterSet > m_dynamic_reg_sets
Definition: RegisterInfoPOSIX_arm64.h:151
RegisterInfoPOSIX_arm64::IsSVERegVG
bool IsSVERegVG(unsigned reg) const
Definition: RegisterInfoPOSIX_arm64.cpp:388
lldb_private::ArchSpec
Definition: ArchSpec.h:33
RegisterInfoPOSIX_arm64::IsMTEReg
bool IsMTEReg(unsigned reg) const
Definition: RegisterInfoPOSIX_arm64.cpp:398
RegisterInfoPOSIX_arm64::m_per_vq_reg_infos
per_vq_register_infos m_per_vq_reg_infos
Definition: RegisterInfoPOSIX_arm64.h:134
lldb_private::Flags::AnySet
bool AnySet(ValueType mask) const
Test one or more flags.
Definition: Flags.h:90
RegisterInfoPOSIX_arm64::GPR
Definition: RegisterInfoPOSIX_arm64.h:43
RegisterInfoPOSIX_arm64::m_register_info_p
const lldb_private::RegisterInfo * m_register_info_p
Definition: RegisterInfoPOSIX_arm64.h:138
RegisterInfoPOSIX_arm64::GetRegisterSetCount
size_t GetRegisterSetCount() const override
Definition: RegisterInfoPOSIX_arm64.cpp:255
lldb_private::LLVM_PACKED_END
LLVM_PACKED_END
Definition: RegisterContext_x86.h:258
RegisterInfoPOSIX_arm64::GPR::pc
uint64_t pc
Definition: RegisterInfoPOSIX_arm64.h:48
RegisterInfoPOSIX_arm64::VReg::bytes
uint8_t bytes[16]
Definition: RegisterInfoPOSIX_arm64.h:55
SVEState::FPSIMD
@ FPSIMD
RegisterInfoPOSIX_arm64::FPU
Definition: RegisterInfoPOSIX_arm64.h:59
lldb_private::Flags
Definition: Flags.h:22
RegisterInfoPOSIX_arm64::VReg
Definition: RegisterInfoPOSIX_arm64.h:54
RegisterInfoPOSIX_arm64::m_register_info_count
uint32_t m_register_info_count
Definition: RegisterInfoPOSIX_arm64.h:139
RegisterInfoPOSIX_arm64::AddRegSetPAuth
void AddRegSetPAuth()
Definition: RegisterInfoPOSIX_arm64.cpp:276
SVEState::Disabled
@ Disabled
RegisterInfoPOSIX_arm64::GetFPRSize
size_t GetFPRSize() const override
Definition: RegisterInfoPOSIX_arm64.cpp:246
RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVEMax
@ eVectorQuadwordAArch64SVEMax
Definition: RegisterInfoPOSIX_arm64.h:38
RegisterInfoPOSIX_arm64::FPU::fpcr
uint32_t fpcr
Definition: RegisterInfoPOSIX_arm64.h:62
RegisterInfoPOSIX_arm64::DBG::bvr
uint64_t bvr[16]
Definition: RegisterInfoPOSIX_arm64.h:74
RegisterInfoPOSIX_arm64::GPR::sp
uint64_t sp
Definition: RegisterInfoPOSIX_arm64.h:47
lldb_private::RegisterInfoAndSetInterface
Definition: RegisterInfoAndSetInterface.h:20
RegisterInfoPOSIX_arm64
Definition: RegisterInfoPOSIX_arm64.h:20
RegisterInfoPOSIX_arm64::GPR::lr
uint64_t lr
Definition: RegisterInfoPOSIX_arm64.h:46
RegisterInfoPOSIX_arm64::IsMTEEnabled
bool IsMTEEnabled() const
Definition: RegisterInfoPOSIX_arm64.h:113
SVEState
SVEState
Definition: RegisterInfoPOSIX_arm64.h:18
RegisterInfoPOSIX_arm64::DBG::mdscr_el1
uint64_t mdscr_el1
Definition: RegisterInfoPOSIX_arm64.h:78
RegisterInfoPOSIX_arm64::m_per_regset_regnum_range
std::map< uint32_t, std::pair< uint32_t, uint32_t > > m_per_regset_regnum_range
Definition: RegisterInfoPOSIX_arm64.h:146
RegisterInfoPOSIX_arm64::FPU::v
VReg v[32]
Definition: RegisterInfoPOSIX_arm64.h:60
RegisterInfoPOSIX_arm64::EXC::exception
uint32_t exception
Definition: RegisterInfoPOSIX_arm64.h:69
RegisterInfoPOSIX_arm64::GetRegisterSetFromRegisterIndex
size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override
Definition: RegisterInfoPOSIX_arm64.cpp:259
RegisterInfoPOSIX_arm64::ConfigureVectorLength
uint32_t ConfigureVectorLength(uint32_t sve_vq)
Definition: RegisterInfoPOSIX_arm64.cpp:309
RegisterInfoPOSIX_arm64::IsPAuthEnabled
bool IsPAuthEnabled() const
Definition: RegisterInfoPOSIX_arm64.h:112
RegisterInfoPOSIX_arm64::eRegsetMaskPAuth
@ eRegsetMaskPAuth
Definition: RegisterInfoPOSIX_arm64.h:29
RegisterInfoPOSIX_arm64::RegisterInfoPOSIX_arm64
RegisterInfoPOSIX_arm64(const lldb_private::ArchSpec &target_arch, lldb_private::Flags opt_regsets)
Definition: RegisterInfoPOSIX_arm64.cpp:186
SVEState::Full
@ Full
RegisterInfoPOSIX_arm64::m_opt_regsets
lldb_private::Flags m_opt_regsets
Definition: RegisterInfoPOSIX_arm64.h:148
RegisterInfoPOSIX_arm64::GetRegNumFPCR
uint32_t GetRegNumFPCR() const
Definition: RegisterInfoPOSIX_arm64.cpp:408
RegisterInfoPOSIX_arm64::FPU::fpsr
uint32_t fpsr
Definition: RegisterInfoPOSIX_arm64.h:61
RegisterInfoPOSIX_arm64::EXC::far
uint64_t far
Definition: RegisterInfoPOSIX_arm64.h:67
RegisterInfoPOSIX_arm64::IsSVEZReg
bool IsSVEZReg(unsigned reg) const
Definition: RegisterInfoPOSIX_arm64.cpp:380
RegisterInfoPOSIX_arm64::DBG::bcr
uint64_t bcr[16]
Definition: RegisterInfoPOSIX_arm64.h:75
RegisterInfoPOSIX_arm64::EXC
Definition: RegisterInfoPOSIX_arm64.h:66
RegisterInfoAndSetInterface.h
RegisterInfoPOSIX_arm64::EXC::esr
uint32_t esr
Definition: RegisterInfoPOSIX_arm64.h:68
RegisterInfoPOSIX_arm64::AddRegSetMTE
void AddRegSetMTE()
Definition: RegisterInfoPOSIX_arm64.cpp:294
RegisterInfoPOSIX_arm64::m_vector_reg_vq
uint32_t m_vector_reg_vq
Definition: RegisterInfoPOSIX_arm64.h:136
RegisterInfoPOSIX_arm64::pauth_regnum_collection
std::vector< uint32_t > pauth_regnum_collection
Definition: RegisterInfoPOSIX_arm64.h:153
RegisterInfoPOSIX_arm64::m_dynamic_reg_infos
std::vector< lldb_private::RegisterInfo > m_dynamic_reg_infos
Definition: RegisterInfoPOSIX_arm64.h:150
RegisterInfoPOSIX_arm64::DBG::wcr
uint64_t wcr[16]
Definition: RegisterInfoPOSIX_arm64.h:77
RegisterInfoPOSIX_arm64::GetRegNumSVEFFR
uint32_t GetRegNumSVEFFR() const
Definition: RegisterInfoPOSIX_arm64.cpp:406
RegisterInfoPOSIX_arm64::m_register_set_count
uint32_t m_register_set_count
Definition: RegisterInfoPOSIX_arm64.h:142
RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64
@ eVectorQuadwordAArch64
Definition: RegisterInfoPOSIX_arm64.h:36
lldb-private.h
RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE
@ eVectorQuadwordAArch64SVE
Definition: RegisterInfoPOSIX_arm64.h:37
RegisterInfoPOSIX_arm64::GetMTEOffset
uint32_t GetMTEOffset() const
Definition: RegisterInfoPOSIX_arm64.cpp:418
RegisterInfoPOSIX_arm64::GetRegisterSet
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) const override
Definition: RegisterInfoPOSIX_arm64.cpp:270
RegisterInfoPOSIX_arm64::FPRegSet
@ FPRegSet
Definition: RegisterInfoPOSIX_arm64.h:23
RegisterInfoPOSIX_arm64::eRegsetMaskDynamic
@ eRegsetMaskDynamic
Definition: RegisterInfoPOSIX_arm64.h:31
SVEState::Unknown
@ Unknown
RegisterInfoPOSIX_arm64::GetRegNumSVEZ0
uint32_t GetRegNumSVEZ0() const
Definition: RegisterInfoPOSIX_arm64.cpp:404
RegisterInfoPOSIX_arm64::GetPAuthOffset
uint32_t GetPAuthOffset() const
Definition: RegisterInfoPOSIX_arm64.cpp:414
uint32_t
RegisterInfoPOSIX_arm64::GPR::fp
uint64_t fp
Definition: RegisterInfoPOSIX_arm64.h:45
RegisterInfoPOSIX_arm64::GetGPRSize
size_t GetGPRSize() const override
Definition: RegisterInfoPOSIX_arm64.cpp:242
RegisterInfoPOSIX_arm64::eRegsetMaskDefault
@ eRegsetMaskDefault
Definition: RegisterInfoPOSIX_arm64.h:27
RegisterInfoPOSIX_arm64::per_vq_register_infos
std::map< uint32_t, std::vector< lldb_private::RegisterInfo > > per_vq_register_infos
Definition: RegisterInfoPOSIX_arm64.h:132
RegisterInfoPOSIX_arm64::IsSVEPReg
bool IsSVEPReg(unsigned reg) const
Definition: RegisterInfoPOSIX_arm64.cpp:384
RegisterInfoPOSIX_arm64::IsSVEReg
bool IsSVEReg(unsigned reg) const
Definition: RegisterInfoPOSIX_arm64.cpp:373
RegisterInfoPOSIX_arm64::GetRegNumSVEVG
uint32_t GetRegNumSVEVG() const
Definition: RegisterInfoPOSIX_arm64.cpp:412
RegisterInfoPOSIX_arm64::GPR::x
uint64_t x[29]
Definition: RegisterInfoPOSIX_arm64.h:44
RegisterInfoPOSIX_arm64::DBG
Definition: RegisterInfoPOSIX_arm64.h:73
Flags.h
RegisterInfoPOSIX_arm64::GPR::cpsr
uint32_t cpsr
Definition: RegisterInfoPOSIX_arm64.h:49
RegisterInfoPOSIX_arm64::VectorSizeIsValid
bool VectorSizeIsValid(uint32_t vq)
Definition: RegisterInfoPOSIX_arm64.h:105
RegisterInfoPOSIX_arm64::IsPAuthReg
bool IsPAuthReg(unsigned reg) const
Definition: RegisterInfoPOSIX_arm64.cpp:392
RegisterInfoPOSIX_arm64::m_register_set_p
const lldb_private::RegisterSet * m_register_set_p
Definition: RegisterInfoPOSIX_arm64.h:141
RegisterInfoPOSIX_arm64::eRegsetMaskMTE
@ eRegsetMaskMTE
Definition: RegisterInfoPOSIX_arm64.h:30
RegisterInfoPOSIX_arm64::m_mte_regnum_collection
std::vector< uint32_t > m_mte_regnum_collection
Definition: RegisterInfoPOSIX_arm64.h:154
RegisterInfoPOSIX_arm64::DBG::wvr
uint64_t wvr[16]
Definition: RegisterInfoPOSIX_arm64.h:76
RegisterInfoPOSIX_arm64::GetRegisterCount
uint32_t GetRegisterCount() const override
Definition: RegisterInfoPOSIX_arm64.cpp:238
RegisterContext.h
RegisterInfoPOSIX_arm64::GetRegNumFPSR
uint32_t GetRegNumFPSR() const
Definition: RegisterInfoPOSIX_arm64.cpp:410