1 //===-- RegisterContextFreeBSD_i386.cpp ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===---------------------------------------------------------------------===//
10 #include "RegisterContextFreeBSD_i386.h"
11 #include "RegisterContextPOSIX_x86.h"
13 using namespace lldb_private;
16 // http://svnweb.freebsd.org/base/head/sys/x86/include/reg.h
40 uint32_t dr[8]; /* debug registers */
41 /* Index 0-3: debug address registers */
42 /* Index 4-5: reserved */
43 /* Index 6: debug status */
44 /* Index 7: debug control */
47 using FPR_i386 = FXSAVE;
54 #define DR_SIZE sizeof(uint32_t)
55 #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(dbreg, dr[reg_index]))
57 //---------------------------------------------------------------------------
58 // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
59 //---------------------------------------------------------------------------
60 #define DECLARE_REGISTER_INFOS_I386_STRUCT
61 #include "RegisterInfos_i386.h"
62 #undef DECLARE_REGISTER_INFOS_I386_STRUCT
64 RegisterContextFreeBSD_i386::RegisterContextFreeBSD_i386(
65 const ArchSpec &target_arch)
66 : RegisterInfoInterface(target_arch) {}
68 size_t RegisterContextFreeBSD_i386::GetGPRSize() const { return sizeof(GPR); }
70 const RegisterInfo *RegisterContextFreeBSD_i386::GetRegisterInfo() const {
71 switch (m_target_arch.GetMachine()) {
72 case llvm::Triple::x86:
73 return g_register_infos_i386;
75 assert(false && "Unhandled target architecture.");
80 uint32_t RegisterContextFreeBSD_i386::GetRegisterCount() const {
81 return static_cast<uint32_t>(sizeof(g_register_infos_i386) /
82 sizeof(g_register_infos_i386[0]));