brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · d5cc501 Raw
95 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#if defined(__riscv) && __riscv_xlen == 6410 11#ifndef lldb_NativeRegisterContextLinux_riscv64_h12#define lldb_NativeRegisterContextLinux_riscv64_h13 14#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"15#include "Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h"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 74  RegisterInfoPOSIX_riscv64::GPR m_gpr;75 76  RegisterInfoPOSIX_riscv64::FPR m_fpr;77 78  size_t GetRegContextSize();79 80  bool IsGPR(unsigned reg) const;81 82  bool IsFPR(unsigned reg) const;83 84  uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;85 86  const RegisterInfoPOSIX_riscv64 &GetRegisterInfo() const;87};88 89} // namespace process_linux90} // namespace lldb_private91 92#endif // #ifndef lldb_NativeRegisterContextLinux_riscv64_h93 94#endif // defined(__riscv) && __riscv_xlen == 6495