1//===-- RegisterContextPOSIXCore_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_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM64_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM64_H
11
12#include "Plugins/Process/Utility/LinuxPTraceDefines_arm64sve.h"
13#include "Plugins/Process/Utility/RegisterContextPOSIX_arm64.h"
14#include "Plugins/Process/Utility/RegisterFlagsLinux_arm64.h"
15
16#include "Plugins/Process/elf-core/RegisterUtilities.h"
17#include "lldb/Utility/DataBufferHeap.h"
18#include "lldb/Utility/DataExtractor.h"
19
20class RegisterContextCorePOSIX_arm64 : public RegisterContextPOSIX_arm64 {
21public:
22 static std::unique_ptr<RegisterContextCorePOSIX_arm64>
23 Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch,
24 const lldb_private::DataExtractor &gpregset,
25 llvm::ArrayRef<lldb_private::CoreNote> notes);
26
27 ~RegisterContextCorePOSIX_arm64() override;
28
29 bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
30 lldb_private::RegisterValue &value) override;
31
32 bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
33 const lldb_private::RegisterValue &value) override;
34
35 bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
36
37 bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
38
39 bool HardwareSingleStep(bool enable) override;
40
41protected:
42 RegisterContextCorePOSIX_arm64(
43 lldb_private::Thread &thread,
44 std::unique_ptr<RegisterInfoPOSIX_arm64> register_info,
45 const lldb_private::DataExtractor &gpregset,
46 llvm::ArrayRef<lldb_private::CoreNote> notes);
47
48 bool ReadGPR() override;
49
50 bool ReadFPR() override;
51
52 bool WriteGPR() override;
53
54 bool WriteFPR() override;
55
56private:
57 lldb_private::DataExtractor m_gpr_data;
58 lldb_private::DataExtractor m_fpr_data;
59 lldb_private::DataExtractor m_sve_data;
60 lldb_private::DataExtractor m_pac_data;
61 lldb_private::DataExtractor m_tls_data;
62 lldb_private::DataExtractor m_za_data;
63 lldb_private::DataExtractor m_mte_data;
64 lldb_private::DataExtractor m_zt_data;
65
66 SVEState m_sve_state = SVEState::Unknown;
67 uint16_t m_sve_vector_length = 0;
68
69 // These are pseudo registers derived from the values in SSVE and ZA data.
70 struct __attribute__((packed)) sme_pseudo_regs {
71 uint64_t ctrl_reg;
72 uint64_t svg_reg;
73 };
74 static_assert(sizeof(sme_pseudo_regs) == 16);
75
76 struct sme_pseudo_regs m_sme_pseudo_regs;
77
78 lldb_private::LinuxArm64RegisterFlags m_linux_register_flags;
79
80 const uint8_t *GetSVEBuffer(uint64_t offset = 0);
81
82 void ConfigureRegisterContext();
83
84 uint32_t CalculateSVEOffset(const lldb_private::RegisterInfo *reg_info);
85
86 uint64_t GetSVERegVG() { return m_sve_vector_length / 8; }
87};
88
89#endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM64_H
90

source code of lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h