1 //===-- RegisterContextPOSIXCore_arm64.h ------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM64_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM64_H
12 #include "Plugins/Process/Utility/LinuxPTraceDefines_arm64sve.h"
13 #include "Plugins/Process/Utility/RegisterContextPOSIX_arm64.h"
15 #include "Plugins/Process/elf-core/RegisterUtilities.h"
16 #include "lldb/Utility/DataBufferHeap.h"
17 #include "lldb/Utility/DataExtractor.h"
19 class RegisterContextCorePOSIX_arm64
: public RegisterContextPOSIX_arm64
{
21 static std::unique_ptr
<RegisterContextCorePOSIX_arm64
>
22 Create(lldb_private::Thread
&thread
, const lldb_private::ArchSpec
&arch
,
23 const lldb_private::DataExtractor
&gpregset
,
24 llvm::ArrayRef
<lldb_private::CoreNote
> notes
);
26 ~RegisterContextCorePOSIX_arm64() override
;
28 bool ReadRegister(const lldb_private::RegisterInfo
*reg_info
,
29 lldb_private::RegisterValue
&value
) override
;
31 bool WriteRegister(const lldb_private::RegisterInfo
*reg_info
,
32 const lldb_private::RegisterValue
&value
) override
;
34 bool ReadAllRegisterValues(lldb::WritableDataBufferSP
&data_sp
) override
;
36 bool WriteAllRegisterValues(const lldb::DataBufferSP
&data_sp
) override
;
38 bool HardwareSingleStep(bool enable
) override
;
41 RegisterContextCorePOSIX_arm64(
42 lldb_private::Thread
&thread
,
43 std::unique_ptr
<RegisterInfoPOSIX_arm64
> register_info
,
44 const lldb_private::DataExtractor
&gpregset
,
45 llvm::ArrayRef
<lldb_private::CoreNote
> notes
);
47 bool ReadGPR() override
;
49 bool ReadFPR() override
;
51 bool WriteGPR() override
;
53 bool WriteFPR() override
;
56 lldb_private::DataExtractor m_gpr_data
;
57 lldb_private::DataExtractor m_fpr_data
;
58 lldb_private::DataExtractor m_sve_data
;
59 lldb_private::DataExtractor m_pac_data
;
60 lldb_private::DataExtractor m_tls_data
;
61 lldb_private::DataExtractor m_za_data
;
62 lldb_private::DataExtractor m_mte_data
;
64 SVEState m_sve_state
= SVEState::Unknown
;
65 uint16_t m_sve_vector_length
= 0;
67 // These are pseudo registers derived from the values in SSVE and ZA data.
68 struct __attribute__((packed
)) sme_pseudo_regs
{
72 static_assert(sizeof(sme_pseudo_regs
) == 16);
74 struct sme_pseudo_regs m_sme_pseudo_regs
;
76 const uint8_t *GetSVEBuffer(uint64_t offset
= 0);
78 void ConfigureRegisterContext();
80 uint32_t CalculateSVEOffset(const lldb_private::RegisterInfo
*reg_info
);
82 uint64_t GetSVERegVG() { return m_sve_vector_length
/ 8; }
85 #endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM64_H