1 //===-- RegisterContextOpenBSD_i386.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_i386.h"
10 #include "RegisterContextPOSIX_x86.h"
12 using namespace lldb_private
;
15 // /usr/include/machine/reg.h
36 uint32_t dr
[8]; /* debug registers */
37 /* Index 0-3: debug address registers */
38 /* Index 4-5: reserved */
39 /* Index 6: debug status */
40 /* Index 7: debug control */
43 using FPR_i386
= FXSAVE
;
50 #define DR_SIZE sizeof(uint32_t)
51 #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(dbreg, dr[reg_index]))
53 // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
54 #define DECLARE_REGISTER_INFOS_I386_STRUCT
55 #include "RegisterInfos_i386.h"
56 #undef DECLARE_REGISTER_INFOS_I386_STRUCT
58 RegisterContextOpenBSD_i386::RegisterContextOpenBSD_i386(
59 const ArchSpec
&target_arch
)
60 : RegisterInfoInterface(target_arch
) {}
62 size_t RegisterContextOpenBSD_i386::GetGPRSize() const { return sizeof(GPR
); }
64 const RegisterInfo
*RegisterContextOpenBSD_i386::GetRegisterInfo() const {
65 switch (GetTargetArchitecture().GetMachine()) {
66 case llvm::Triple::x86
:
67 return g_register_infos_i386
;
69 assert(false && "Unhandled target architecture.");
74 uint32_t RegisterContextOpenBSD_i386::GetRegisterCount() const {
75 return static_cast<uint32_t>(sizeof(g_register_infos_i386
) /
76 sizeof(g_register_infos_i386
[0]));