master
h 69 lines 1.84 KB
Raw
1 /*
2 * FreeBSD i386 register structures
3 *
4 * Copyright (c) 2015 Stacey D. Son
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 #ifndef TARGET_ARCH_REG_H
9 #define TARGET_ARCH_REG_H
10
11 /* See sys/i386/include/reg.h */
12 typedef struct target_reg {
13 uint32_t r_fs;
14 uint32_t r_es;
15 uint32_t r_ds;
16 uint32_t r_edi;
17 uint32_t r_esi;
18 uint32_t r_ebp;
19 uint32_t r_isp;
20 uint32_t r_ebx;
21 uint32_t r_edx;
22 uint32_t r_ecx;
23 uint32_t r_eax;
24 uint32_t r_trapno;
25 uint32_t r_err;
26 uint32_t r_eip;
27 uint32_t r_cs;
28 uint32_t r_eflags;
29 uint32_t r_esp;
30 uint32_t r_ss;
31 uint32_t r_gs;
32 } target_reg_t;
33
34 typedef struct target_fpreg {
35 uint32_t fpr_env[7];
36 uint8_t fpr_acc[8][10];
37 uint32_t fpr_ex_sw;
38 uint8_t fpr_pad[64];
39 } target_fpreg_t;
40
41 static inline void target_copy_regs(target_reg_t *regs, const CPUX86State *env)
42 {
43
44 regs->r_fs = env->segs[R_FS].selector & 0xffff;
45 regs->r_es = env->segs[R_ES].selector & 0xffff;
46 regs->r_ds = env->segs[R_DS].selector & 0xffff;
47
48 regs->r_edi = env->regs[R_EDI];
49 regs->r_esi = env->regs[R_ESI];
50 regs->r_ebp = env->regs[R_EBP];
51 /* regs->r_isp = env->regs[R_ISP]; XXX */
52 regs->r_ebx = env->regs[R_EBX];
53 regs->r_edx = env->regs[R_EDX];
54 regs->r_ecx = env->regs[R_ECX];
55 regs->r_eax = env->regs[R_EAX];
56 /* regs->r_trapno = env->regs[R_TRAPNO]; XXX */
57 regs->r_err = env->error_code; /* XXX ? */
58 regs->r_eip = env->eip;
59
60 regs->r_cs = env->segs[R_CS].selector & 0xffff;
61
62 regs->r_eflags = env->eflags;
63 regs->r_esp = env->regs[R_ESP];
64
65 regs->r_ss = env->segs[R_SS].selector & 0xffff;
66 regs->r_gs = env->segs[R_GS].selector & 0xffff;
67 }
68
69 #endif /* TARGET_ARCH_REG_H */