diff --git a/sys/amd64/include/reg.h b/sys/amd64/include/reg.h index 9ca092fea104..89211a32651b 100644 --- a/sys/amd64/include/reg.h +++ b/sys/amd64/include/reg.h @@ -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; diff --git a/sys/amd64/include/ucontext.h b/sys/amd64/include/ucontext.h index 5c1380336321..c5bbd65b5a30 100644 --- a/sys/amd64/include/ucontext.h +++ b/sys/amd64/include/ucontext.h @@ -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 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_ */ diff --git a/sys/compat/ia32/ia32_signal.h b/sys/compat/ia32/ia32_signal.h index f2be96d5100b..6ebb0defc634 100644 --- a/sys/compat/ia32/ia32_signal.h +++ b/sys/compat/ia32/ia32_signal.h @@ -59,7 +59,9 @@ struct ia32_mcontext { * See 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 { diff --git a/sys/i386/include/ucontext.h b/sys/i386/include/ucontext.h index c992495fedf8..d8657d3e6f6d 100644 --- a/sys/i386/include/ucontext.h +++ b/sys/i386/include/ucontext.h @@ -72,10 +72,15 @@ typedef struct __mcontext { * See 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) */