aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2024-09-08 01:06:46 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-09-08 01:06:46 +0200
commitf1e3d1e78f8e72bfb2e518ac0ad5ea273dc54b76 (patch)
tree6caf96fdfe0cbcf5680f7e6486e875877b3ff0da
parente10d0db83b66678a215572d84d23576f5df5a774 (diff)
downloadgnumach-f1e3d1e78f8e72bfb2e518ac0ad5ea273dc54b76.tar.gz
gnumach-f1e3d1e78f8e72bfb2e518ac0ad5ea273dc54b76.tar.bz2
gnumach-f1e3d1e78f8e72bfb2e518ac0ad5ea273dc54b76.zip
fpu_set_state: return an error on incoherent fp_save_kind
-rw-r--r--i386/i386/fpu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index 43771e7f..cf7d51cd 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -407,6 +407,8 @@ fpu_set_state(const thread_t thread, void *state, int flavor)
ASSERT_IPL(SPL0);
if (fp_kind == FP_NO)
return KERN_FAILURE;
+ if ((flavor == i386_XFLOAT_STATE) && (xfstate->fp_save_kind != fp_save_kind))
+ return KERN_INVALID_ARGUMENT;
#if NCPUS == 1
@@ -494,7 +496,7 @@ ASSERT_IPL(SPL0);
ifps->fp_save_state.fp_ds = user_fp_state->fp_ds;
ifps->fp_regs = *user_fp_regs;
}
- } else if ((flavor == i386_XFLOAT_STATE) && (xfstate->fp_save_kind == fp_save_kind)) {
+ } else if (flavor == i386_XFLOAT_STATE) {
int i;
struct i386_xfp_save *user_fp_state = (struct i386_xfp_save *) &xfstate->hw_state[0];
ifps->xfp_save_state.fp_control = user_fp_state->fp_control;