LLDB mainline
RegisterInfoOpenBSD_x86_64.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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//===----------------------------------------------------------------------===//
8
10#include "RegisterContext_x86.h"
12#include "lldb/lldb-defines.h"
13#include <vector>
14
15using namespace lldb_private;
16using namespace lldb;
17
18// /usr/include/machine/reg.h
19typedef struct _GPR {
20 uint64_t rdi;
21 uint64_t rsi;
22 uint64_t rdx;
23 uint64_t rcx;
24 uint64_t r8;
25 uint64_t r9;
26 uint64_t r10;
27 uint64_t r11;
28 uint64_t r12;
29 uint64_t r13;
30 uint64_t r14;
31 uint64_t r15;
32 uint64_t rbp;
33 uint64_t rbx;
34 uint64_t rax;
35 uint64_t rsp;
36 uint64_t rip;
37 uint64_t rflags;
38 uint64_t cs;
39 uint64_t ss;
40 uint64_t ds;
41 uint64_t es;
42 uint64_t fs;
43 uint64_t gs;
45
46struct DBG {
47 uint64_t dr[16]; /* debug registers */
48 /* Index 0-3: debug address registers */
49 /* Index 4-5: reserved */
50 /* Index 6: debug status */
51 /* Index 7: debug control */
52 /* Index 8-15: reserved */
53};
54
55struct UserArea {
56 GPR gpr;
57 FPR fpr;
58 DBG dbg;
59};
60
61#define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
62
63// Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64
64// structure.
65#define DECLARE_REGISTER_INFOS_X86_64_STRUCT
67#undef DECLARE_REGISTER_INFOS_X86_64_STRUCT
68
69static const RegisterInfo *
71 switch (target_arch.GetMachine()) {
72 case llvm::Triple::x86_64:
73 return g_register_infos_x86_64;
74 default:
75 assert(false && "Unhandled target architecture.");
76 return nullptr;
77 }
78}
79
80static uint32_t
82 switch (target_arch.GetMachine()) {
83 case llvm::Triple::x86_64:
84 return static_cast<uint32_t>(sizeof(g_register_infos_x86_64) /
85 sizeof(g_register_infos_x86_64[0]));
86 default:
87 assert(false && "Unhandled target architecture.");
88 return 0;
89 }
90}
91
97
98size_t RegisterInfoOpenBSD_x86_64::GetGPRSize() const { return sizeof(GPR); }
99
103
#define GPR(r16)
Definition ABIX86.cpp:145
struct _FPR FPR
static const RegisterInfo * PrivateGetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch)
static uint32_t PrivateGetRegisterCount(const lldb_private::ArchSpec &target_arch)
static const RegisterInfo * PrivateGetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch)
struct _GPR GPR
static uint32_t PrivateGetRegisterCount(const lldb_private::ArchSpec &target_arch)
RegisterInfoOpenBSD_x86_64(const lldb_private::ArchSpec &target_arch)
const lldb_private::RegisterInfo * GetRegisterInfo() const override
uint32_t GetRegisterCount() const override
const lldb_private::RegisterInfo * m_register_info_p
An architecture specification class.
Definition ArchSpec.h:32
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition ArchSpec.cpp:886
RegisterInfoInterface(const lldb_private::ArchSpec &target_arch)
A class that represents a running process on the host machine.
GPR_linux_mips gpr
FPR_linux_mips fpr
Every register is described in detail including its name, alternate name (optional),...