Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / FreeBSD / NativeRegisterContextFreeBSD_x86_64.h
blob54ec9fc154ca22674901045ccc2b50faf928c8ae
1 //===-- NativeRegisterContextFreeBSD_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 //===----------------------------------------------------------------------===//
9 #if defined(__i386__) || defined(__x86_64__)
11 #ifndef lldb_NativeRegisterContextFreeBSD_x86_64_h
12 #define lldb_NativeRegisterContextFreeBSD_x86_64_h
14 // clang-format off
15 #include <sys/param.h>
16 #include <sys/ptrace.h>
17 #include <sys/types.h>
18 #include <machine/reg.h>
19 // clang-format on
21 #include <array>
22 #include <optional>
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 {
39 public:
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 &reg_value) override;
49 Status WriteRegister(const RegisterInfo *reg_info,
50 const RegisterValue &reg_value) override;
52 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
54 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
56 llvm::Error
57 CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD &source) override;
59 private:
60 // Private member types.
61 enum RegSetKind {
62 GPRegSet,
63 FPRegSet,
64 DBRegSet,
65 YMMRegSet,
66 MPXRegSet,
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);
85 struct YMMSplitPtr {
86 void *xmm;
87 void *ymm_hi;
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__)