From 50335291ae0d647cb7f73e44d303568e7c848af0 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 28 Apr 2010 13:51:02 +0000 Subject: [PATCH] kernel: fpu_init: only enable OSXMMEXCPT in CR4 on at least SSE1 machines. Found and debugged by totalinux at yandex.ru and Evgeniy Ivanov, thanks! --- kernel/arch/i386/arch_system.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index 67e19f058..934bea2a9 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -154,9 +154,15 @@ PRIVATE void fpu_init(void) if(_cpufeature(_CPUF_I386_FXSR)) { register struct proc *rp; phys_bytes aligned_fp_area; + u32_t cr4 = read_cr4() | CR4_OSFXSR; /* Enable FXSR. */ - /* Enable FXSR feature usage. */ - write_cr4(read_cr4() | CR4_OSFXSR | CR4_OSXMMEXCPT); + /* OSXMMEXCPT if supported + * FXSR feature can be available without SSE + */ + if(_cpufeature(_CPUF_I386_SSE)) + cr4 |= CR4_OSXMMEXCPT; + + write_cr4(cr4); osfxsr_feature = 1; for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) { -- 2.44.0