1 //===-- RegisterContextOpenBSD_x86_64.cpp ---------------------------------===//
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 #include "RegisterContextOpenBSD_x86_64.h"
10 #include "RegisterContextPOSIX_x86.h"
13 using namespace lldb_private
;
16 // /usr/include/machine/reg.h
45 uint64_t dr
[16]; /* debug registers */
46 /* Index 0-3: debug address registers */
47 /* Index 4-5: reserved */
48 /* Index 6: debug status */
49 /* Index 7: debug control */
50 /* Index 8-15: reserved */
59 #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
61 // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64
63 #define DECLARE_REGISTER_INFOS_X86_64_STRUCT
64 #include "RegisterInfos_x86_64.h"
65 #undef DECLARE_REGISTER_INFOS_X86_64_STRUCT
67 static const RegisterInfo
*
68 PrivateGetRegisterInfoPtr(const lldb_private::ArchSpec
&target_arch
) {
69 switch (target_arch
.GetMachine()) {
70 case llvm::Triple::x86_64
:
71 return g_register_infos_x86_64
;
73 assert(false && "Unhandled target architecture.");
79 PrivateGetRegisterCount(const lldb_private::ArchSpec
&target_arch
) {
80 switch (target_arch
.GetMachine()) {
81 case llvm::Triple::x86_64
:
82 return static_cast<uint32_t>(sizeof(g_register_infos_x86_64
) /
83 sizeof(g_register_infos_x86_64
[0]));
85 assert(false && "Unhandled target architecture.");
90 RegisterContextOpenBSD_x86_64::RegisterContextOpenBSD_x86_64(
91 const ArchSpec
&target_arch
)
92 : lldb_private::RegisterInfoInterface(target_arch
),
93 m_register_info_p(PrivateGetRegisterInfoPtr(target_arch
)),
94 m_register_count(PrivateGetRegisterCount(target_arch
)) {}
96 size_t RegisterContextOpenBSD_x86_64::GetGPRSize() const { return sizeof(GPR
); }
98 const RegisterInfo
*RegisterContextOpenBSD_x86_64::GetRegisterInfo() const {
99 return m_register_info_p
;
102 uint32_t RegisterContextOpenBSD_x86_64::GetRegisterCount() const {
103 return m_register_count
;