RegisterContextFreeBSD_i386.cpp revision 263363
1//===-- RegisterContextFreeBSD_i386.cpp ------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===---------------------------------------------------------------------===//
9
10#include "RegisterContextPOSIX_x86.h"
11#include "RegisterContextFreeBSD_i386.h"
12
13using namespace lldb_private;
14using namespace lldb;
15
16// http://svnweb.freebsd.org/base/head/sys/x86/include/reg.h
17struct GPR
18{
19    uint32_t fs;
20    uint32_t es;
21    uint32_t ds;
22    uint32_t edi;
23    uint32_t esi;
24    uint32_t ebp;
25    uint32_t isp;
26    uint32_t ebx;
27    uint32_t edx;
28    uint32_t ecx;
29    uint32_t eax;
30    uint32_t trapno;
31    uint32_t err;
32    uint32_t eip;
33    uint32_t cs;
34    uint32_t eflags;
35    uint32_t esp;
36    uint32_t ss;
37    uint32_t gs;
38};
39
40#define DR_SIZE 0
41#define DR_OFFSET(reg_index) 0
42
43//---------------------------------------------------------------------------
44// Include RegisterInfos_i386 to declare our g_register_infos_i386 structure.
45//---------------------------------------------------------------------------
46#define DECLARE_REGISTER_INFOS_I386_STRUCT
47#include "RegisterInfos_i386.h"
48#undef DECLARE_REGISTER_INFOS_I386_STRUCT
49
50RegisterContextFreeBSD_i386::RegisterContextFreeBSD_i386(const ArchSpec &target_arch) :
51    RegisterInfoInterface(target_arch)
52{
53}
54
55RegisterContextFreeBSD_i386::~RegisterContextFreeBSD_i386()
56{
57}
58
59size_t
60RegisterContextFreeBSD_i386::GetGPRSize()
61{
62    return sizeof(GPR);
63}
64
65const RegisterInfo *
66RegisterContextFreeBSD_i386::GetRegisterInfo()
67{
68    switch (m_target_arch.GetCore())
69    {
70        case ArchSpec::eCore_x86_32_i386:
71        case ArchSpec::eCore_x86_32_i486:
72        case ArchSpec::eCore_x86_32_i486sx:
73            return g_register_infos_i386;
74        default:
75            assert(false && "Unhandled target architecture.");
76            return NULL;
77    }
78}
79