================ @@ -0,0 +1,81 @@ +//===-- NativeRegisterContextFreeBSD_riscv64.h --------------------*- C++ +//-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#if defined(__riscv) && __riscv_xlen == 64 + +#ifndef lldb_NativeRegisterContextFreeBSD_riscv64_h +#define lldb_NativeRegisterContextFreeBSD_riscv64_h + +// clang-format off +#include <sys/types.h> +#include <sys/param.h> +#include <machine/reg.h> +// clang-format on + +#include "Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h" +#include "Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h" + +namespace lldb_private { +namespace process_freebsd { + +class NativeRegisterContextFreeBSD_riscv64 + : public NativeRegisterContextFreeBSD { +public: + NativeRegisterContextFreeBSD_riscv64(const ArchSpec &target_arch, + NativeThreadFreeBSD &native_thread); + + uint32_t GetRegisterSetCount() const override; + uint32_t GetUserRegisterCount() const override; + const RegisterSet *GetRegisterSet(uint32_t set_index) const override; + + Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) override; + Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) override; + Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override; + Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + + void InvalidateAllRegisters() override; + +private: + // FreeBSD's native register structures + struct reg m_gpr; + struct fpreg m_fpr; + + bool m_gpr_is_valid; + bool m_fpr_is_valid; + + // Ptrace wrappers + Status ReadGPR(); + Status WriteGPR(); + Status ReadFPR(); + Status WriteFPR(); + + // Conversion functions between FreeBSD and POSIX layouts ---------------- DavidSpickett wrote:
Which are needed why exactly? This conversion could get very expensive if done often. https://github.com/llvm/llvm-project/pull/180549 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
