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
18enum class SVEState : uint8_t { Unknown, Disabled, FPSIMD, Full, Streaming };
19
22public:
23 enum { GPRegSet = 0, FPRegSet };
24
25 // AArch64 register set mask value
26 enum {
35 };
36
37 // AArch64 Register set FP/SIMD feature configuration
38 enum {
42 };
43
44 // based on RegisterContextDarwin_arm64.h
45 LLVM_PACKED_START
46 struct GPR {
47 uint64_t x[29]; // x0-x28
48 uint64_t fp; // x29
49 uint64_t lr; // x30
50 uint64_t sp; // x31
51 uint64_t pc; // pc
52 uint32_t cpsr; // cpsr
53 uint32_t pad;
54 };
55 LLVM_PACKED_END
56
57 // based on RegisterContextDarwin_arm64.h
58 struct VReg {
59 uint8_t bytes[16];
60 };
61
62 // based on RegisterContextDarwin_arm64.h
63 struct FPU {
64 VReg v[32];
65 uint32_t fpsr;
66 uint32_t fpcr;
67 };
68
69 // based on RegisterContextDarwin_arm64.h
70 struct EXC {
71 uint64_t far; // Virtual Fault Address
72 uint32_t esr; // Exception syndrome
73 uint32_t exception; // number of arm exception token
74 };
75
76 // based on RegisterContextDarwin_arm64.h
77 struct DBG {
78 uint64_t bvr[16];
79 uint64_t bcr[16];
80 uint64_t wvr[16];
81 uint64_t wcr[16];
82 uint64_t mdscr_el1;
83 };
84
86 lldb_private::Flags opt_regsets);
87
88 static size_t GetGPRSizeStatic();
89 size_t GetGPRSize() const override { return GetGPRSizeStatic(); }
90
91 size_t GetFPRSize() const override;
92
93 const lldb_private::RegisterInfo *GetRegisterInfo() const override;
94
95 uint32_t GetRegisterCount() const override;
96
98 GetRegisterSet(size_t reg_set) const override;
99
100 size_t GetRegisterSetCount() const override;
101
102 size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
103
104 void AddRegSetPAuth();
105
106 void AddRegSetMTE();
107
108 void AddRegSetTLS(bool has_tpidr2);
109
110 void AddRegSetSME();
111
112 uint32_t ConfigureVectorLengthSVE(uint32_t sve_vq);
113
114 void ConfigureVectorLengthZA(uint32_t za_vq);
115
116 bool VectorSizeIsValid(uint32_t vq) {
117 // coverity[unsigned_compare]
119 return true;
120 return false;
121 }
122
129
130 bool IsSVEReg(unsigned reg) const;
131 bool IsSVEZReg(unsigned reg) const;
132 bool IsSVEPReg(unsigned reg) const;
133 bool IsSVERegVG(unsigned reg) const;
134 bool IsPAuthReg(unsigned reg) const;
135 bool IsMTEReg(unsigned reg) const;
136 bool IsTLSReg(unsigned reg) const;
137 bool IsSMEReg(unsigned reg) const;
138 bool IsSMERegZA(unsigned reg) const;
139
140 uint32_t GetRegNumSVEZ0() const;
141 uint32_t GetRegNumSVEFFR() const;
142 uint32_t GetRegNumFPCR() const;
143 uint32_t GetRegNumFPSR() const;
144 uint32_t GetRegNumSVEVG() const;
145 uint32_t GetRegNumSMESVG() const;
146 uint32_t GetPAuthOffset() const;
147 uint32_t GetMTEOffset() const;
148 uint32_t GetTLSOffset() const;
149 uint32_t GetSMEOffset() const;
150
151private:
152 typedef std::map<uint32_t, std::vector<lldb_private::RegisterInfo>>
154
156
159
160 // In normal operation this is const. Only when SVE or SME registers change
161 // size is it either replaced or the content modified.
164
167
168 // Contains pair of [start, end] register numbers of a register set with start
169 // and end included.
170 std::map<uint32_t, std::pair<uint32_t, uint32_t>> m_per_regset_regnum_range;
171
173
174 std::vector<lldb_private::RegisterInfo> m_dynamic_reg_infos;
175 std::vector<lldb_private::RegisterSet> m_dynamic_reg_sets;
176
177 std::vector<uint32_t> pauth_regnum_collection;
178 std::vector<uint32_t> m_mte_regnum_collection;
179 std::vector<uint32_t> m_tls_regnum_collection;
180 std::vector<uint32_t> m_sme_regnum_collection;
181};
182
183#endif
std::map< uint32_t, std::pair< uint32_t, uint32_t > > m_per_regset_regnum_range
std::vector< lldb_private::RegisterInfo > m_dynamic_reg_infos
bool IsSVERegVG(unsigned reg) const
lldb_private::Flags m_opt_regsets
void AddRegSetTLS(bool has_tpidr2)
const lldb_private::RegisterInfo * m_register_info_p
uint32_t ConfigureVectorLengthSVE(uint32_t sve_vq)
std::vector< uint32_t > m_tls_regnum_collection
void ConfigureVectorLengthZA(uint32_t za_vq)
std::vector< lldb_private::RegisterSet > m_dynamic_reg_sets
std::vector< uint32_t > m_mte_regnum_collection
const lldb_private::RegisterInfo * GetRegisterInfo() const override
bool IsSVEZReg(unsigned reg) const
bool IsPAuthReg(unsigned reg) const
bool IsSMERegZA(unsigned reg) const
size_t GetRegisterSetCount() const override
const lldb_private::RegisterSet * m_register_set_p
size_t GetGPRSize() const override
std::vector< uint32_t > pauth_regnum_collection
std::map< uint32_t, std::vector< lldb_private::RegisterInfo > > per_vq_register_infos
bool IsSVEReg(unsigned reg) const
bool IsSVEPReg(unsigned reg) const
bool IsTLSReg(unsigned reg) const
bool IsMTEReg(unsigned reg) const
size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override
per_vq_register_infos m_per_vq_reg_infos
uint32_t GetRegisterCount() const override
size_t GetFPRSize() const override
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) const override
std::vector< uint32_t > m_sme_regnum_collection
bool IsSMEReg(unsigned reg) const
An architecture specification class.
Definition: ArchSpec.h:31
A class to manage flags.
Definition: Flags.h:22
bool AnySet(ValueType mask) const
Test one or more flags.
Definition: Flags.h:90
Every register is described in detail including its name, alternate name (optional),...
Registers are grouped into register sets.