[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / lldb / source / Plugins / Process / Linux / NativeRegisterContextLinux_riscv64.h
blobd5cc50131cdc3011d02ee27ad44ab289ed1d02d2
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 //===----------------------------------------------------------------------===//
9 #if defined(__riscv) && __riscv_xlen == 64
11 #ifndef lldb_NativeRegisterContextLinux_riscv64_h
12 #define lldb_NativeRegisterContextLinux_riscv64_h
14 #include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
15 #include "Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h"
17 #include <asm/ptrace.h>
19 namespace lldb_private {
20 namespace process_linux {
22 class NativeProcessLinux;
24 class NativeRegisterContextLinux_riscv64 : public NativeRegisterContextLinux {
25 public:
26 NativeRegisterContextLinux_riscv64(
27 const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
28 std::unique_ptr<RegisterInfoPOSIX_riscv64> register_info_up);
30 uint32_t GetRegisterSetCount() const override;
32 uint32_t GetUserRegisterCount() const override;
34 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
36 Status ReadRegister(const RegisterInfo *reg_info,
37 RegisterValue &reg_value) override;
39 Status WriteRegister(const RegisterInfo *reg_info,
40 const RegisterValue &reg_value) override;
42 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
44 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
46 void InvalidateAllRegisters() override;
48 std::vector<uint32_t>
49 GetExpeditedRegisters(ExpeditedRegs expType) const override;
51 bool RegisterOffsetIsDynamic() const override { return true; }
53 protected:
54 Status ReadGPR() override;
56 Status WriteGPR() override;
58 Status ReadFPR() override;
60 Status WriteFPR() override;
62 void *GetGPRBuffer() override { return &m_gpr; }
64 void *GetFPRBuffer() override { return &m_fpr; }
66 size_t GetGPRSize() const override { return GetRegisterInfo().GetGPRSize(); }
68 size_t GetFPRSize() override { return GetRegisterInfo().GetFPRSize(); }
70 private:
71 bool m_gpr_is_valid;
72 bool m_fpu_is_valid;
74 RegisterInfoPOSIX_riscv64::GPR m_gpr;
76 RegisterInfoPOSIX_riscv64::FPR m_fpr;
78 size_t GetRegContextSize();
80 bool IsGPR(unsigned reg) const;
82 bool IsFPR(unsigned reg) const;
84 uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
86 const RegisterInfoPOSIX_riscv64 &GetRegisterInfo() const;
89 } // namespace process_linux
90 } // namespace lldb_private
92 #endif // #ifndef lldb_NativeRegisterContextLinux_riscv64_h
94 #endif // defined(__riscv) && __riscv_xlen == 64