2 * FreeBSD i386 register structures
4 * Copyright (c) 2015 Stacey Son
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef TARGET_ARCH_REG_H
22 #define TARGET_ARCH_REG_H
24 /* See sys/i386/include/reg.h */
25 typedef struct target_reg
{
47 typedef struct target_fpreg
{
49 uint8_t fpr_acc
[8][10];
54 static inline void target_copy_regs(target_reg_t
*regs
, const CPUX86State
*env
)
57 regs
->r_fs
= env
->segs
[R_FS
].selector
& 0xffff;
58 regs
->r_es
= env
->segs
[R_ES
].selector
& 0xffff;
59 regs
->r_ds
= env
->segs
[R_DS
].selector
& 0xffff;
61 regs
->r_edi
= env
->regs
[R_EDI
];
62 regs
->r_esi
= env
->regs
[R_ESI
];
63 regs
->r_ebp
= env
->regs
[R_EBP
];
64 /* regs->r_isp = env->regs[R_ISP]; XXX */
65 regs
->r_ebx
= env
->regs
[R_EBX
];
66 regs
->r_edx
= env
->regs
[R_EDX
];
67 regs
->r_ecx
= env
->regs
[R_ECX
];
68 regs
->r_eax
= env
->regs
[R_EAX
];
69 /* regs->r_trapno = env->regs[R_TRAPNO]; XXX */
70 regs
->r_err
= env
->error_code
; /* XXX ? */
71 regs
->r_eip
= env
->eip
;
73 regs
->r_cs
= env
->segs
[R_CS
].selector
& 0xffff;
75 regs
->r_eflags
= env
->eflags
;
76 regs
->r_esp
= env
->regs
[R_ESP
];
78 regs
->r_ss
= env
->segs
[R_SS
].selector
& 0xffff;
79 regs
->r_gs
= env
->segs
[R_GS
].selector
& 0xffff;
82 #endif /* TARGET_ARCH_REG_H */