1 //===-- NativeRegisterContextNetBSD_x86_64.h --------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #if defined(__i386__) || defined(__x86_64__)
11 #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
12 #define lldb_NativeRegisterContextNetBSD_x86_64_h
15 #include <sys/param.h>
16 #include <sys/types.h>
17 #include <sys/ptrace.h>
18 #include <machine/reg.h>
24 #include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h"
25 #include "Plugins/Process/Utility/RegisterContext_x86.h"
26 #include "Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h"
27 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
29 namespace lldb_private
{
30 namespace process_netbsd
{
32 class NativeProcessNetBSD
;
34 class NativeRegisterContextNetBSD_x86_64
35 : public NativeRegisterContextNetBSD
,
36 public NativeRegisterContextDBReg_x86
{
38 NativeRegisterContextNetBSD_x86_64(const ArchSpec
&target_arch
,
39 NativeThreadProtocol
&native_thread
);
40 uint32_t GetRegisterSetCount() const override
;
42 const RegisterSet
*GetRegisterSet(uint32_t set_index
) const override
;
44 Status
ReadRegister(const RegisterInfo
*reg_info
,
45 RegisterValue
®_value
) override
;
47 Status
WriteRegister(const RegisterInfo
*reg_info
,
48 const RegisterValue
®_value
) override
;
50 Status
ReadAllRegisterValues(lldb::WritableDataBufferSP
&data_sp
) override
;
52 Status
WriteAllRegisterValues(const lldb::DataBufferSP
&data_sp
) override
;
55 CopyHardwareWatchpointsFrom(NativeRegisterContextNetBSD
&source
) override
;
58 // Private member types.
63 MaxRegularRegSet
= DBRegSet
,
66 MaxRegSet
= MPXRegSet
,
69 // Private member variables.
70 std::array
<uint8_t, sizeof(struct reg
)> m_gpr
;
71 std::array
<uint8_t, sizeof(struct xstate
)> m_xstate
;
72 std::array
<uint8_t, sizeof(struct dbreg
)> m_dbr
;
73 std::array
<size_t, MaxRegularRegSet
+ 1> m_regset_offsets
;
75 std::optional
<RegSetKind
> GetSetForNativeRegNum(uint32_t reg_num
) const;
77 Status
ReadRegisterSet(RegSetKind set
);
78 Status
WriteRegisterSet(RegSetKind set
);
80 uint8_t *GetOffsetRegSetData(RegSetKind set
, size_t reg_offset
);
86 std::optional
<YMMSplitPtr
> GetYMMSplitReg(uint32_t reg
);
89 } // namespace process_netbsd
90 } // namespace lldb_private
92 #endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
94 #endif // defined(__x86_64__)