1 //===-- NativeRegisterContextNetBSD_x86_64.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(__i386__) || defined(__x86_64__) 10 11 #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h 12 #define lldb_NativeRegisterContextNetBSD_x86_64_h 13 14 // clang-format off 15 #include <sys/param.h> 16 #include <sys/types.h> 17 #include <sys/ptrace.h> 18 #include <machine/reg.h> 19 // clang-format on 20 21 #include <array> 22 23 #include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h" 24 #include "Plugins/Process/Utility/RegisterContext_x86.h" 25 #include "Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h" 26 #include "Plugins/Process/Utility/lldb-x86-register-enums.h" 27 28 namespace lldb_private { 29 namespace process_netbsd { 30 31 class NativeProcessNetBSD; 32 33 class NativeRegisterContextNetBSD_x86_64 34 : public NativeRegisterContextNetBSD, 35 public NativeRegisterContextDBReg_x86 { 36 public: 37 NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch, 38 NativeThreadProtocol &native_thread); 39 uint32_t GetRegisterSetCount() const override; 40 41 const RegisterSet *GetRegisterSet(uint32_t set_index) const override; 42 43 Status ReadRegister(const RegisterInfo *reg_info, 44 RegisterValue ®_value) override; 45 46 Status WriteRegister(const RegisterInfo *reg_info, 47 const RegisterValue ®_value) override; 48 49 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override; 50 51 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; 52 53 llvm::Error 54 CopyHardwareWatchpointsFrom(NativeRegisterContextNetBSD &source) override; 55 56 private: 57 // Private member types. 58 enum RegSetKind { 59 GPRegSet, 60 FPRegSet, 61 DBRegSet, 62 MaxRegularRegSet = DBRegSet, 63 YMMRegSet, 64 MPXRegSet, 65 MaxRegSet = MPXRegSet, 66 }; 67 68 // Private member variables. 69 std::array<uint8_t, sizeof(struct reg)> m_gpr; 70 std::array<uint8_t, sizeof(struct xstate)> m_xstate; 71 std::array<uint8_t, sizeof(struct dbreg)> m_dbr; 72 std::array<size_t, MaxRegularRegSet + 1> m_regset_offsets; 73 74 llvm::Optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const; 75 76 Status ReadRegisterSet(RegSetKind set); 77 Status WriteRegisterSet(RegSetKind set); 78 79 uint8_t *GetOffsetRegSetData(RegSetKind set, size_t reg_offset); 80 81 struct YMMSplitPtr { 82 void *xmm; 83 void *ymm_hi; 84 }; 85 llvm::Optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg); 86 }; 87 88 } // namespace process_netbsd 89 } // namespace lldb_private 90 91 #endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h 92 93 #endif // defined(__x86_64__) 94