Arion 1.0.2-alpha
A high-performance C++ framework for emulating executable binaries.
 
Loading...
Searching...
No Matches
lnx_arch_x86-64.hpp
Go to the documentation of this file.
1#ifndef ARION_LNX_ARCH_X8664_HPP
2#define ARION_LNX_ARCH_X8664_HPP
3
7
9{
10
13{
15 unsigned long r15;
17 unsigned long r14;
19 unsigned long r13;
21 unsigned long r12;
23 unsigned long bp;
25 unsigned long bx;
27 unsigned long r11;
29 unsigned long r10;
31 unsigned long r9;
33 unsigned long r8;
35 unsigned long ax;
37 unsigned long cx;
39 unsigned long dx;
41 unsigned long si;
43 unsigned long di;
45 unsigned long orig_ax;
47 unsigned long ip;
49 unsigned long cs;
51 unsigned long flags;
53 unsigned long sp;
55 unsigned long ss;
57 unsigned long fs_base;
59 unsigned long gs_base;
61 unsigned long ds;
63 unsigned long es;
65 unsigned long fs;
67 unsigned long gs;
68};
69
71inline std::vector<arion::REG> uc_user_regs = {
72 UC_X86_REG_R15, UC_X86_REG_R14, UC_X86_REG_R13, UC_X86_REG_R12, UC_X86_REG_RBP, UC_X86_REG_RBX,
73 UC_X86_REG_R11, UC_X86_REG_R10, UC_X86_REG_R9, UC_X86_REG_R8, UC_X86_REG_RAX, UC_X86_REG_RCX,
74 UC_X86_REG_RDX, UC_X86_REG_RSI, UC_X86_REG_RDI, UC_X86_REG_INVALID, UC_X86_REG_RIP, UC_X86_REG_CS,
75 UC_X86_REG_RFLAGS, UC_X86_REG_RSP, UC_X86_REG_SS, UC_X86_REG_FS_BASE, UC_X86_REG_GS_BASE, UC_X86_REG_DS,
76 UC_X86_REG_ES, UC_X86_REG_FS, UC_X86_REG_GS};
77
79const size_t ELF_NGREG = (sizeof(struct user_regs_struct) / sizeof(arion_lnx_type::elf_greg_t));
82
93
96{
98 unsigned short cwd;
100 unsigned short swd;
102 unsigned short twd;
103
105 unsigned short fop;
107 __u64 rip;
109 __u64 rdp;
111 __u32 mxcsr;
115 __u32 st_space[32];
117 __u32 xmm_space[64];
119 __u32 padding[24];
120};
121
123inline std::vector<arion::REG> uc_st_space_regs = {UC_X86_REG_FP0, UC_X86_REG_FP1, UC_X86_REG_FP2, UC_X86_REG_FP3,
124 UC_X86_REG_FP4, UC_X86_REG_FP5, UC_X86_REG_FP6, UC_X86_REG_FP7};
125
127inline std::vector<arion::REG> uc_xmm_space_regs = {
128 UC_X86_REG_XMM0, UC_X86_REG_XMM1, UC_X86_REG_XMM2, UC_X86_REG_XMM3, UC_X86_REG_XMM4, UC_X86_REG_XMM5,
129 UC_X86_REG_XMM6, UC_X86_REG_XMM7, UC_X86_REG_XMM8, UC_X86_REG_XMM9, UC_X86_REG_XMM10, UC_X86_REG_XMM11,
130 UC_X86_REG_XMM12, UC_X86_REG_XMM13, UC_X86_REG_XMM14, UC_X86_REG_XMM15, UC_X86_REG_XMM16, UC_X86_REG_XMM17,
131 UC_X86_REG_XMM18, UC_X86_REG_XMM19, UC_X86_REG_XMM20, UC_X86_REG_XMM21, UC_X86_REG_XMM22, UC_X86_REG_XMM23,
132 UC_X86_REG_XMM24, UC_X86_REG_XMM25, UC_X86_REG_XMM26, UC_X86_REG_XMM27, UC_X86_REG_XMM28, UC_X86_REG_XMM29,
133 UC_X86_REG_XMM30, UC_X86_REG_XMM31};
134
137
140{
141 private:
147 std::map<arion::REG, arion::RVAL> prstatus_to_regs(std::vector<arion::BYTE> prstatus) override;
153 std::map<arion::REG, arion::RVAL> fpregset_to_regs(std::vector<arion::BYTE> fpregset) override;
154};
155
156}; // namespace arion_lnx_x86_64
157
158#endif // ARION_LNX_ARCH_X8664_HPP
Abstract base class for managing Linux architecture-specific details, particularly for core dump pars...
Definition lnx_arch_manager.hpp:28
Linux x86-64 architecture manager class for Arion.
Definition lnx_arch_x86-64.hpp:140
std::map< arion::REG, arion::RVAL > fpregset_to_regs(std::vector< arion::BYTE > fpregset) override
std::map< arion::REG, arion::RVAL > prstatus_to_regs(std::vector< arion::BYTE > prstatus) override
A class responsible for performing architecture specific operations in case of an x86-64 chip emulati...
Definition arch_x86-64.hpp:592
Definition lnx_kernel_utils.hpp:16
unsigned long elf_greg_t
Type definition for a single general-purpose register value in an ELF core dump.
Definition lnx_kernel_utils.hpp:100
Definition lnx_arch_x86-64.hpp:9
arion_lnx_type::elf_greg_t elf_gregset_t[ELF_NGREG]
Definition of the general-purpose register set type for ELF notes (NT_PRSTATUS).
Definition lnx_arch_x86-64.hpp:81
std::vector< arion::REG > uc_user_regs
A vector mapping the user_regs_struct fields to ARION's universal register enumeration (arion::REG).
Definition lnx_arch_x86-64.hpp:71
const size_t ELF_NGREG
The number of 64-bit words (general registers) in the user_regs_struct, used for ELF notes.
Definition lnx_arch_x86-64.hpp:79
std::vector< arion::REG > uc_xmm_space_regs
A vector mapping the SSE/AVX register space (xmm_space) to ARION's universal register enumeration.
Definition lnx_arch_x86-64.hpp:127
std::vector< arion::REG > uc_st_space_regs
A vector mapping the FPU stack register space (st_space) to ARION's universal register enumeration.
Definition lnx_arch_x86-64.hpp:123
Common fields shared across architecture-specific elf_prstatus structures in core dumps.
Definition lnx_kernel_utils.hpp:72
Structure for a process status ELF note (NT_PRSTATUS) for x86-64, containing general registers.
Definition lnx_arch_x86-64.hpp:85
elf_gregset_t pr_reg
The general-purpose registers captured.
Definition lnx_arch_x86-64.hpp:89
int pr_fpvalid
Flag indicating whether floating-point registers are valid.
Definition lnx_arch_x86-64.hpp:91
Flag indicating whether floating-point registers are valid.
Definition lnx_arch_x86-64.hpp:96
unsigned short twd
FPU Tag Word.
Definition lnx_arch_x86-64.hpp:102
__u32 xmm_space[64]
SSE/AVX registers XMM0-XMM15 (128-bit/256-bit).
Definition lnx_arch_x86-64.hpp:117
unsigned short cwd
FPU Control Word.
Definition lnx_arch_x86-64.hpp:98
__u32 mxcsr_mask
MXCSR mask.
Definition lnx_arch_x86-64.hpp:113
__u32 st_space[32]
FPU stack registers ST0-ST7 (80-bit extended precision).
Definition lnx_arch_x86-64.hpp:115
__u64 rip
FPU Instruction Pointer.
Definition lnx_arch_x86-64.hpp:107
__u32 mxcsr
MXCSR register (SSE control/status).
Definition lnx_arch_x86-64.hpp:111
__u32 padding[24]
Padding for alignment.
Definition lnx_arch_x86-64.hpp:119
__u64 rdp
FPU Data Pointer.
Definition lnx_arch_x86-64.hpp:109
unsigned short fop
FPU Opcode.
Definition lnx_arch_x86-64.hpp:105
unsigned short swd
FPU Status Word.
Definition lnx_arch_x86-64.hpp:100
Structure representing the x86-64 general-purpose registers as saved by the Linux kernel on the stack...
Definition lnx_arch_x86-64.hpp:13
unsigned long ax
Accumulator register (RAX/AX).
Definition lnx_arch_x86-64.hpp:35
unsigned long fs
FS Segment selector.
Definition lnx_arch_x86-64.hpp:65
unsigned long ss
Stack Segment selector (SS).
Definition lnx_arch_x86-64.hpp:55
unsigned long gs_base
GS Segment Base address.
Definition lnx_arch_x86-64.hpp:59
unsigned long r13
R13 register.
Definition lnx_arch_x86-64.hpp:19
unsigned long cs
Code Segment selector (CS).
Definition lnx_arch_x86-64.hpp:49
unsigned long flags
Flags register (RFLAGS).
Definition lnx_arch_x86-64.hpp:51
unsigned long orig_ax
Original value of AX/RAX before a syscall (used to detect syscall return).
Definition lnx_arch_x86-64.hpp:45
unsigned long r12
R12 register.
Definition lnx_arch_x86-64.hpp:21
unsigned long si
Source Index register (RSI/SI).
Definition lnx_arch_x86-64.hpp:41
unsigned long es
Extra Segment selector (ES).
Definition lnx_arch_x86-64.hpp:63
unsigned long sp
Stack Pointer register (RSP/SP).
Definition lnx_arch_x86-64.hpp:53
unsigned long r14
R14 register.
Definition lnx_arch_x86-64.hpp:17
unsigned long bx
Base register (RBX/BX).
Definition lnx_arch_x86-64.hpp:25
unsigned long r15
R15 register.
Definition lnx_arch_x86-64.hpp:15
unsigned long r11
R11 register.
Definition lnx_arch_x86-64.hpp:27
unsigned long ip
Instruction Pointer register (RIP/IP).
Definition lnx_arch_x86-64.hpp:47
unsigned long fs_base
FS Segment Base address.
Definition lnx_arch_x86-64.hpp:57
unsigned long bp
Base Pointer register (RBP/BP).
Definition lnx_arch_x86-64.hpp:23
unsigned long gs
GS Segment selector.
Definition lnx_arch_x86-64.hpp:67
unsigned long cx
Counter register (RCX/CX).
Definition lnx_arch_x86-64.hpp:37
unsigned long ds
Data Segment selector (DS).
Definition lnx_arch_x86-64.hpp:61
unsigned long r8
R8 register.
Definition lnx_arch_x86-64.hpp:33
unsigned long dx
Data register (RDX/DX).
Definition lnx_arch_x86-64.hpp:39
unsigned long di
Destination Index register (RDI/DI).
Definition lnx_arch_x86-64.hpp:43
unsigned long r9
R9 register.
Definition lnx_arch_x86-64.hpp:31
unsigned long r10
R10 register.
Definition lnx_arch_x86-64.hpp:29