summaryrefslogtreecommitdiff
path: root/i386/include
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-29 16:20:21 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-29 16:20:21 +0100
commit261eb7f1ade265bb359609a796715fa06f4d32fd (patch)
tree283adca5d013fa7c9d0efdb430ac7167f5750bae /i386/include
parent5dbc6990b16a969e470392abe48e8ff9552780b3 (diff)
x86: Fix initialization of new threads
fninit does not clear MMX/SSE/AVX registers, so we have to use rstor to clear them when starting a new thread. Along the way, we can as well just have a default state to be loaded in each new thread. * i386/include/mach/i386/fp_reg.h (XSAVE_XCOMP_BV_COMPACT): New macro. * i386/i386/fpu.h (fp_default_state): New variable declaration. * i386/i386/fpu.c (fp_default_state): New variable. (MXCSR_DEFAULT, CWD_DEFAULT): New macros. (fpu_module_init): Allocate and initialize fp_default_state. (fpinit): rstor from fp_default_state instead of setting FPU state by hand. (fp_load): Copy initial state from fp_default_state instead of setting it to 0. This is more future-proof since this is the exact state that we are loading in fpinit. (fp_state_alloc): fp_state_alloc: Copy initial state from fp_default_state.
Diffstat (limited to 'i386/include')
-rw-r--r--i386/include/mach/i386/fp_reg.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/i386/include/mach/i386/fp_reg.h b/i386/include/mach/i386/fp_reg.h
index 41301ec4..7a3735ae 100644
--- a/i386/include/mach/i386/fp_reg.h
+++ b/i386/include/mach/i386/fp_reg.h
@@ -53,6 +53,7 @@ struct i386_fp_regs {
/* space for 8 80-bit FP registers */
};
+#define XSAVE_XCOMP_BV_COMPACT (((uint64_t)1) << 63)
struct i386_xfp_xstate_header {
uint64_t xfp_features;
uint64_t xcomp_bv;