LLDB mainline
NativeRegisterContextLinux_riscv64.h
Go to the documentation of this file.
1//===-- NativeRegisterContextLinux_riscv64.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#if defined(__riscv) && __riscv_xlen == 64
10
11#ifndef lldb_NativeRegisterContextLinux_riscv64_h
12#define lldb_NativeRegisterContextLinux_riscv64_h
13
16
17#include <asm/ptrace.h>
18
19namespace lldb_private {
20namespace process_linux {
21
22class NativeProcessLinux;
23
24class NativeRegisterContextLinux_riscv64 : public NativeRegisterContextLinux {
25public:
26 NativeRegisterContextLinux_riscv64(
27 const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
28 std::unique_ptr<RegisterInfoPOSIX_riscv64> register_info_up);
29
30 uint32_t GetRegisterSetCount() const override;
31
32 uint32_t GetUserRegisterCount() const override;
33
34 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
35
36 Status ReadRegister(const RegisterInfo *reg_info,
37 RegisterValue &reg_value) override;
38
39 Status WriteRegister(const RegisterInfo *reg_info,
40 const RegisterValue &reg_value) override;
41
42 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
43
44 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
45
46 void InvalidateAllRegisters() override;
47
48 std::vector<uint32_t>
49 GetExpeditedRegisters(ExpeditedRegs expType) const override;
50
51 bool RegisterOffsetIsDynamic() const override { return true; }
52
53protected:
54 Status ReadGPR() override;
55
56 Status WriteGPR() override;
57
58 Status ReadFPR() override;
59
60 Status WriteFPR() override;
61
62 void *GetGPRBuffer() override { return &m_gpr; }
63
64 void *GetFPRBuffer() override { return &m_fpr; }
65
66 size_t GetGPRSize() const override { return GetRegisterInfo().GetGPRSize(); }
67
68 size_t GetFPRSize() override { return GetRegisterInfo().GetFPRSize(); }
69
70private:
71 bool m_gpr_is_valid;
72 bool m_fpu_is_valid;
73
75
77
78 bool IsGPR(unsigned reg) const;
79
80 bool IsFPR(unsigned reg) const;
81
82 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
83
84 const RegisterInfoPOSIX_riscv64 &GetRegisterInfo() const;
85};
86
87} // namespace process_linux
88} // namespace lldb_private
89
90#endif // #ifndef lldb_NativeRegisterContextLinux_riscv64_h
91
92#endif // defined(__riscv) && __riscv_xlen == 64
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:328
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:329