From b670c2c99ec73b62442407f5cf77c121faba7f5a Mon Sep 17 00:00:00 2001 From: Alexander Polakov Date: Thu, 26 Nov 2009 20:17:34 +0300 Subject: [PATCH] Detect FPU by checking CPUID features. Fixes problems on AMD Geode LX-800. Reported-by: bleader Obtained-from: FreeBSD --- sys/platform/pc32/isa/npx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/platform/pc32/isa/npx.c b/sys/platform/pc32/isa/npx.c index 6f99b4f890..858f7c493c 100644 --- a/sys/platform/pc32/isa/npx.c +++ b/sys/platform/pc32/isa/npx.c @@ -310,18 +310,19 @@ npx_probe1(device_t dev) */ fninit(); -#ifdef SMP + device_set_desc(dev, "math processor"); /* - * Exception 16 MUST work for SMP. + * Modern CPUs all have an FPU that uses the INT16 interface + * and provide a simple way to verify that, so handle the + * common case right away. */ - npx_irq13 = 0; - npx_ex16 = hw_float = npx_exists = 1; - device_set_desc(dev, "math processor"); - return (0); - -#else /* !SMP */ - device_set_desc(dev, "math processor"); + if (cpu_feature & CPUID_FPU) { + npx_irq13 = 0; + npx_ex16 = hw_float = npx_exists = 1; + return (0); + } +#ifndef SMP /* * Don't use fwait here because it might hang. * Don't use fnop here because it usually hangs if there is no FPU. -- 2.11.4.GIT