summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-28 12:07:41 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-28 12:08:31 +0100
commit44e3fb20a17dac403ec022a9c4d41dc237f3c79d (patch)
tree5439f6f4b664bd33ca4e18c1d24f7f9d0a6e9963 /i386
parentad753a3e1c6c6fb100fa4c6440b056424f66b3f6 (diff)
fpu: Rename FP_387X to FP_387FX
To leave FP_387X for XSAVE-supporting CPU (as opposed to FXSAVE-supporting CPU) * i386/include/mach/i386/fp_reg.h (FP_387X): Rename to FP_387FX. (FP_387X): New macro. * i386/i386/fpu.c (init_fpu, fpu_set_state, fpu_get_state, fpexterrflt, fpastintr, fp_save, fp_load, fp_state_alloc): Update accordingly. * i386/i386/fpu.h (fpu_save_context): Likewise.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/fpu.c18
-rw-r--r--i386/i386/fpu.h2
-rw-r--r--i386/include/mach/i386/fp_reg.h3
3 files changed, 12 insertions, 11 deletions
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index 3118e4ca..5cbfcb2f 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -152,7 +152,7 @@ init_fpu(void)
static /* because we _need_ alignment */
struct i386_xfp_save save;
unsigned long mask;
- fp_kind = FP_387X;
+ fp_kind = FP_387FX;
#ifndef MACH_RING1
set_cr4(get_cr4() | CR4_OSFXSR);
#endif /* MACH_RING1 */
@@ -361,7 +361,7 @@ ASSERT_IPL(SPL0);
*/
memset(&ifps->fp_save_state, 0, sizeof(struct i386_fp_save));
- if (fp_kind == FP_387X) {
+ if (fp_kind == FP_387FX) {
int i;
ifps->xfp_save_state.fp_control = user_fp_state->fp_control;
@@ -454,7 +454,7 @@ ASSERT_IPL(SPL0);
*/
memset(user_fp_state, 0, sizeof(struct i386_fp_save));
- if (fp_kind == FP_387X) {
+ if (fp_kind == FP_387FX) {
int i;
user_fp_state->fp_control = ifps->xfp_save_state.fp_control;
@@ -697,7 +697,7 @@ fpexterrflt(void)
*/
i386_exception(EXC_ARITHMETIC,
EXC_I386_EXTERR,
- fp_kind == FP_387X ?
+ fp_kind == FP_387FX ?
thread->pcb->ims.ifps->xfp_save_state.fp_status :
thread->pcb->ims.ifps->fp_save_state.fp_status);
/*NOTREACHED*/
@@ -755,7 +755,7 @@ ASSERT_IPL(SPL0);
*/
i386_exception(EXC_ARITHMETIC,
EXC_I386_EXTERR,
- fp_kind == FP_387X ?
+ fp_kind == FP_387FX ?
thread->pcb->ims.ifps->xfp_save_state.fp_status :
thread->pcb->ims.ifps->fp_save_state.fp_status);
/*NOTREACHED*/
@@ -779,7 +779,7 @@ fp_save(thread_t thread)
if (ifps != 0 && !ifps->fp_valid) {
/* registers are in FPU */
ifps->fp_valid = TRUE;
- if (fp_kind == FP_387X)
+ if (fp_kind == FP_387FX)
fxsave(&ifps->xfp_save_state);
else
fnsave(&ifps->fp_save_state);
@@ -822,7 +822,7 @@ ASSERT_IPL(SPL0);
*/
i386_exception(EXC_ARITHMETIC,
EXC_I386_EXTERR,
- fp_kind == FP_387X ?
+ fp_kind == FP_387FX ?
thread->pcb->ims.ifps->xfp_save_state.fp_status :
thread->pcb->ims.ifps->fp_save_state.fp_status);
/*NOTREACHED*/
@@ -831,7 +831,7 @@ ASSERT_IPL(SPL0);
printf("fp_load: invalid FPU state!\n");
fninit ();
} else {
- if (fp_kind == FP_387X)
+ if (fp_kind == FP_387FX)
fxrstor(ifps->xfp_save_state);
else
frstor(ifps->fp_save_state);
@@ -857,7 +857,7 @@ fp_state_alloc(void)
ifps->fp_valid = TRUE;
- if (fp_kind == FP_387X) {
+ if (fp_kind == FP_387FX) {
ifps->xfp_save_state.fp_control = (0x037f
& ~(FPC_IM|FPC_ZM|FPC_OM|FPC_PC))
| (FPC_PC_64|FPC_IC_AFF);
diff --git a/i386/i386/fpu.h b/i386/i386/fpu.h
index 4050cce4..3c5b73c5 100644
--- a/i386/i386/fpu.h
+++ b/i386/i386/fpu.h
@@ -121,7 +121,7 @@ static inline void set_xcr0(uint64_t value) {
if (ifps != 0 && !ifps->fp_valid) { \
/* registers are in FPU - save to memory */ \
ifps->fp_valid = TRUE; \
- if (fp_kind == FP_387X) \
+ if (fp_kind == FP_387FX) \
fxsave(&ifps->xfp_save_state); \
else \
fnsave(&ifps->fp_save_state); \
diff --git a/i386/include/mach/i386/fp_reg.h b/i386/include/mach/i386/fp_reg.h
index 2f25024a..648511ad 100644
--- a/i386/include/mach/i386/fp_reg.h
+++ b/i386/include/mach/i386/fp_reg.h
@@ -125,6 +125,7 @@ _Static_assert(sizeof(struct i386_xfp_save) == 512);
#define FP_SOFT 1 /* software FP emulator */
#define FP_287 2 /* 80287 */
#define FP_387 3 /* 80387 or 80486 */
-#define FP_387X 4 /* FXSAVE/RSTOR-capable */
+#define FP_387FX 4 /* FXSAVE/RSTOR-capable */
+#define FP_387X 5 /* XSAVE/RSTOR-capable */
#endif /* _MACH_I386_FP_REG_H_ */