Add all segment registers for the amd64 CPU to struct reg and mcontext.
To keep these structures ABI-compatible, half the size of r_trapno, r_err, mc_trapno, mc_flags. Add fsbase and gsbase to mcontext on both amd64 and i386. Add flags to amd64 mcontext to indicate that it contains valid segments or bases. In collaboration with: pho Discussed with: peter Reviewed by: jhb
This commit is contained in:
parent
49c9cff881
commit
0cdf4ffabc
@ -56,8 +56,12 @@ struct reg {
|
||||
register_t r_rdx;
|
||||
register_t r_rcx;
|
||||
register_t r_rax;
|
||||
register_t r_trapno;
|
||||
register_t r_err;
|
||||
uint32_t r_trapno;
|
||||
uint16_t r_fs;
|
||||
uint16_t r_gs;
|
||||
uint32_t r_err;
|
||||
uint16_t r_es;
|
||||
uint16_t r_ds;
|
||||
register_t r_rip;
|
||||
register_t r_cs;
|
||||
register_t r_rflags;
|
||||
|
@ -32,9 +32,16 @@
|
||||
#ifndef _MACHINE_UCONTEXT_H_
|
||||
#define _MACHINE_UCONTEXT_H_
|
||||
|
||||
/*
|
||||
* mc_trapno bits. Shall be in sync with TF_XXX.
|
||||
*/
|
||||
#define _MC_HASSEGS 0x1
|
||||
#define _MC_HASBASES 0x2
|
||||
#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES)
|
||||
|
||||
typedef struct __mcontext {
|
||||
/*
|
||||
* The first 20 fields must match the definition of
|
||||
* The first 24 fields must match the definition of
|
||||
* sigcontext. So that we can support sigcontext
|
||||
* and ucontext_t at the same time.
|
||||
*/
|
||||
@ -54,9 +61,13 @@ typedef struct __mcontext {
|
||||
__register_t mc_r13;
|
||||
__register_t mc_r14;
|
||||
__register_t mc_r15;
|
||||
__register_t mc_trapno;
|
||||
__uint32_t mc_trapno;
|
||||
__uint16_t mc_fs;
|
||||
__uint16_t mc_gs;
|
||||
__register_t mc_addr;
|
||||
__register_t mc_flags;
|
||||
__uint32_t mc_flags;
|
||||
__uint16_t mc_es;
|
||||
__uint16_t mc_ds;
|
||||
__register_t mc_err;
|
||||
__register_t mc_rip;
|
||||
__register_t mc_cs;
|
||||
@ -65,6 +76,7 @@ typedef struct __mcontext {
|
||||
__register_t mc_ss;
|
||||
|
||||
long mc_len; /* sizeof(mcontext_t) */
|
||||
|
||||
#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */
|
||||
#define _MC_FPFMT_XMM 0x10002
|
||||
long mc_fpformat;
|
||||
@ -76,7 +88,11 @@ typedef struct __mcontext {
|
||||
* See <machine/fpu.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
long mc_fpstate[64] __aligned(16);
|
||||
long mc_spare[8];
|
||||
|
||||
__register_t mc_fsbase;
|
||||
__register_t mc_gsbase;
|
||||
|
||||
long mc_spare[6];
|
||||
} mcontext_t;
|
||||
|
||||
#endif /* !_MACHINE_UCONTEXT_H_ */
|
||||
|
@ -59,7 +59,9 @@ struct ia32_mcontext {
|
||||
* See <i386/include/npx.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
u_int32_t mc_fpstate[128] __aligned(16);
|
||||
u_int32_t mc_spare2[8];
|
||||
u_int32_t mc_fsbase;
|
||||
u_int32_t mc_gsbase;
|
||||
u_int32_t mc_spare2[6];
|
||||
};
|
||||
|
||||
struct ia32_ucontext {
|
||||
|
@ -72,10 +72,15 @@ typedef struct __mcontext {
|
||||
* See <machine/npx.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
int mc_fpstate[128] __aligned(16);
|
||||
int mc_spare2[8];
|
||||
|
||||
__register_t mc_fsbase;
|
||||
__register_t mc_gsbase;
|
||||
|
||||
int mc_spare2[6];
|
||||
} mcontext_t;
|
||||
|
||||
#if defined(_KERNEL) && defined(COMPAT_FREEBSD4)
|
||||
|
||||
struct mcontext4 {
|
||||
__register_t mc_onstack; /* XXX - sigcontext compat. */
|
||||
__register_t mc_gs; /* machine state (struct trapframe) */
|
||||
|
Loading…
Reference in New Issue
Block a user