diff options
author | Olivier Valentin <valentio@free.fr> | 2024-02-08 17:50:14 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-02-08 21:42:48 +0100 |
commit | 41a4430cb913183f9b0aaa7f04ce5c2514b2de7c (patch) | |
tree | e87d8bf896b1b5488052209a25f9a24cc99a4830 /i386 | |
parent | 25315a5716c70922ba8fd2c821b70abd101f80f5 (diff) | |
download | gnumach-41a4430cb913183f9b0aaa7f04ce5c2514b2de7c.tar.gz gnumach-41a4430cb913183f9b0aaa7f04ce5c2514b2de7c.tar.bz2 gnumach-41a4430cb913183f9b0aaa7f04ce5c2514b2de7c.zip |
Revert "fpu: Fix cpuid feature detection"
This reverts commit f8d0f98e80b3d7d9b24fa077818113fb0f4b3970.
Message-ID: <20240208165015.4700-2-valentio@free.fr>
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386/fpu.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c index 9bf5aecf..fefe5e49 100644 --- a/i386/i386/fpu.c +++ b/i386/i386/fpu.c @@ -174,26 +174,36 @@ init_fpu(void) set_xcr0(fp_xsave_support); #endif /* MACH_RING1 */ - fp_xsave_size = offsetof(struct i386_fpsave_state, xfp_save_state) + ebx; - - if (fp_xsave_size < sizeof(struct i386_fpsave_state)) - panic("CPU-provided xstate size %d " - "is smaller than our minimum %d!\n", - fp_xsave_size, - (int) sizeof(struct i386_fpsave_state)); - eax = 0xd; ecx = 0x1; cpuid(eax, ebx, ecx, edx); + if (eax & CPU_FEATURE_XSAVES) { + fp_xsave_size = offsetof(struct i386_fpsave_state, xfp_save_state) + ebx; + if (fp_xsave_size < sizeof(struct i386_fpsave_state)) + panic("CPU-provided xstate size %d " + "is smaller than our minimum %d!\n", + fp_xsave_size, + (int) sizeof(struct i386_fpsave_state)); - if (eax & CPU_FEATURE_XSAVES) fp_save_kind = FP_XSAVES; - else if (eax & CPU_FEATURE_XSAVEOPT) - fp_save_kind = FP_XSAVEOPT; - else if (eax & CPU_FEATURE_XSAVEC) - fp_save_kind = FP_XSAVEC; - else - fp_save_kind = FP_XSAVE; + } else { + eax = 0xd; + ecx = 0x0; + cpuid(eax, ebx, ecx, edx); + fp_xsave_size = offsetof(struct i386_fpsave_state, xfp_save_state) + ebx; + if(fp_xsave_size < sizeof(struct i386_fpsave_state)) + panic("CPU-provided xstate size %d " + "is smaller than our minimum %d!\n", + fp_xsave_size, + (int) sizeof(struct i386_fpsave_state)); + + if (eax & CPU_FEATURE_XSAVEOPT) + fp_save_kind = FP_XSAVEOPT; + else if (eax & CPU_FEATURE_XSAVEC) + fp_save_kind = FP_XSAVEC; + else + fp_save_kind = FP_XSAVE; + } fp_kind = FP_387X; } |