1 //===-- NativeRegisterContextFreeBSD_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_NativeRegisterContextFreeBSD_x86_64_h
12 #define lldb_NativeRegisterContextFreeBSD_x86_64_h
15 #include <sys/param.h>
16 #include <sys/ptrace.h>
17 #include <sys/types.h>
18 #include <machine/reg.h>
24 #include "Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.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 #define LLDB_INVALID_XSAVE_OFFSET UINT32_MAX
31 namespace lldb_private
{
32 namespace process_freebsd
{
34 class NativeProcessFreeBSD
;
36 class NativeRegisterContextFreeBSD_x86_64
37 : public NativeRegisterContextFreeBSD
,
38 public NativeRegisterContextDBReg_x86
{
40 NativeRegisterContextFreeBSD_x86_64(const ArchSpec
&target_arch
,
41 NativeThreadProtocol
&native_thread
);
42 uint32_t GetRegisterSetCount() const override
;
44 const RegisterSet
*GetRegisterSet(uint32_t set_index
) const override
;
46 Status
ReadRegister(const RegisterInfo
*reg_info
,
47 RegisterValue
®_value
) override
;
49 Status
WriteRegister(const RegisterInfo
*reg_info
,
50 const RegisterValue
®_value
) override
;
52 Status
ReadAllRegisterValues(lldb::WritableDataBufferSP
&data_sp
) override
;
54 Status
WriteAllRegisterValues(const lldb::DataBufferSP
&data_sp
) override
;
57 CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD
&source
) override
;
60 // Private member types.
67 MaxRegSet
= MPXRegSet
,
70 // Private member variables.
71 std::array
<uint8_t, sizeof(struct reg
)> m_gpr
;
72 std::array
<uint8_t, 512> m_fpr
; // FXSAVE
73 std::array
<uint8_t, sizeof(struct dbreg
)> m_dbr
;
74 std::vector
<uint8_t> m_xsave
;
75 std::array
<uint32_t, MaxRegSet
+ 1> m_xsave_offsets
;
76 std::array
<size_t, MaxRegSet
+ 1> m_regset_offsets
;
78 std::optional
<RegSetKind
> GetSetForNativeRegNum(uint32_t reg_num
) const;
80 Status
ReadRegisterSet(RegSetKind set
);
81 Status
WriteRegisterSet(RegSetKind set
);
83 uint8_t *GetOffsetRegSetData(RegSetKind set
, size_t reg_offset
);
89 std::optional
<YMMSplitPtr
> GetYMMSplitReg(uint32_t reg
);
92 } // namespace process_freebsd
93 } // namespace lldb_private
95 #endif // #ifndef lldb_NativeRegisterContextFreeBSD_x86_64_h
97 #endif // defined(__x86_64__)