Module Name:    src
Committed By:   dsl
Date:           Sun Jan 26 19:16:17 UTC 2014

Modified Files:
        src/sys/arch/i386/conf: ALL GENERIC GENERIC_PS2TINY GENERIC_TINY
            INSTALL_FLOPPY INSTALL_TINY NET4501 XEN3_DOM0 XEN3_DOMU files.i386
        src/sys/arch/i386/i386: autoconf.c i386_trap.S locore.S machdep.c
            process_machdep.c trap.c vector.S
        src/sys/arch/i386/include: npx.h
        src/sys/arch/i386/isa: npx.c
        src/sys/arch/i386/pnpbios: files.pnpbios
        src/sys/arch/x86/acpi: acpi_wakeup.c
        src/sys/arch/x86/include: cpu.h
        src/sys/arch/x86/x86: cpu.c ipi.c vm_machdep.c
        src/sys/arch/xen/conf: files.xen
        src/sys/arch/xen/x86: cpu.c xen_ipi.c
        src/sys/arch/xen/xen: hypervisor.c
        src/sys/compat/linux/arch/i386: linux_machdep.c
Removed Files:
        src/sys/arch/i386/acpi: npx_acpi.c
        src/sys/arch/i386/isa: npx_isa.c npxvar.h
        src/sys/arch/i386/pnpbios: npx_pnpbios.c
        src/sys/arch/xen/i386: npx_hv.c

Log Message:
Remove support for 'external' floating point units and the MS-DOS
  compatible method of handling floating point exceptions.
Make kernel support for teh fpu non-optional (486SX should still work).
Only 386 cpus support external fpu, and i386 support was removed years ago.
This means that the npx code no longer uses port 0xf0 or interupt 13.
All the "npx at isa" lines go from the configs, arch/i386/isa/npx.c
  is now mandatory for all i386 kernels.
I've renamed npxinit() to fpuinit() and npxinit_cpu() to fpuinit_cpu()
  to match the very similar amd64 functions.
The fpu of the boot cpu is now initialised by a direct call from
  cpu_configure(), this enables FP emulation for a 486SX.
  (for amd64 the cr0 values are set in locore.S and similar).
This fixes a long-standing bug in linux_setregs() - which did not
  save the fpu regsiters if they were active.
I've test booted a single cpu i386 kernel (using anita).
amd64 builds - none of teh changes should affect it.
The i386 XEN kernels build, but I'm not sure where they set cr0, and
  it might have got lost!


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r0 src/sys/arch/i386/acpi/npx_acpi.c
cvs rdiff -u -r1.366 -r1.367 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1098 -r1.1099 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/conf/GENERIC_PS2TINY
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/i386/conf/GENERIC_TINY
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/conf/INSTALL_FLOPPY
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/i386/conf/INSTALL_TINY
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/i386/conf/NET4501
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.371 -r1.372 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/i386/i386/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.742 -r1.743 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.268 -r1.269 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/include/npx.h
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/i386/isa/npx.c
cvs rdiff -u -r1.22 -r0 src/sys/arch/i386/isa/npx_isa.c
cvs rdiff -u -r1.8 -r0 src/sys/arch/i386/isa/npxvar.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/pnpbios/files.pnpbios
cvs rdiff -u -r1.13 -r0 src/sys/arch/i386/pnpbios/npx_pnpbios.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x86/acpi/acpi_wakeup.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/x86/ipi.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/x86/vm_machdep.c
cvs rdiff -u -r1.129 -r1.130 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.10 -r0 src/sys/arch/xen/i386/npx_hv.c
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.155 -r1.156 src/sys/compat/linux/arch/i386/linux_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.366 src/sys/arch/i386/conf/ALL:1.367
--- src/sys/arch/i386/conf/ALL:1.366	Sat Nov 23 23:36:34 2013
+++ src/sys/arch/i386/conf/ALL	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.366 2013/11/23 23:36:34 riz Exp $
+# $NetBSD: ALL,v 1.367 2014/01/26 19:16:16 dsl Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.366 $"
+#ident 		"ALL-$Revision: 1.367 $"
 
 maxusers	64		# estimated number of users
 
@@ -388,7 +388,6 @@ hpet*		at acpinodebus?		# High Precision
 joy*		at acpi?		# Joystick/Game port
 lpt*		at acpi?		# Parallel port
 mpu*		at acpi?		# Roland MPU-401 MIDI UART
-npx*		at acpi?		# Math coprocessor
 pckbc*		at acpi?		# PC keyboard controller
 pcppi*		at acpi?		# AT-style speaker sound
 thinkpad*	at acpi?		# IBM/Lenovo Thinkpad hotkeys
@@ -437,7 +436,6 @@ lpt*		at pnpbios? index ?	# parallel por
 
 pckbc*		at pnpbios? index ?	# PC keyboard/mouse controller
 fdc*		at pnpbios? index ?	# floppy controller
-npx*		at pnpbios? index ?	# Math coprocessor
 
 # IDE controller on Toshiba Portege 3000 series (crippled PCI device)
 pciide* 	at pnpbios? index ?
@@ -557,12 +555,6 @@ cardslot*	at cbb?
 cardbus*	at cardslot?
 pcmcia* 	at cardslot?
 
-# Coprocessor Support
-
-# Math Coprocessor support
-npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
-
 # Console Devices
 
 # wscons

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1098 src/sys/arch/i386/conf/GENERIC:1.1099
--- src/sys/arch/i386/conf/GENERIC:1.1098	Sat Oct 26 09:16:20 2013
+++ src/sys/arch/i386/conf/GENERIC	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1098 2013/10/26 09:16:20 nonaka Exp $
+# $NetBSD: GENERIC,v 1.1099 2014/01/26 19:16:16 dsl Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.1098 $"
+#ident 		"GENERIC-$Revision: 1.1099 $"
 
 maxusers	64		# estimated number of users
 
@@ -364,7 +364,6 @@ hpet*		at acpinodebus?		# High Precision
 joy*		at acpi?		# Joystick/Game port
 #lpt*		at acpi?		# Parallel port
 mpu*		at acpi?		# Roland MPU-401 MIDI UART
-npx*		at acpi?		# Math coprocessor
 pckbc*		at acpi?		# PC keyboard controller
 pcppi*		at acpi?		# AT-style speaker sound
 sony*		at acpi?		# Sony Miscellaneous Controller
@@ -409,7 +408,6 @@ wsmouse*	at spic?
 
 #pckbc*		at pnpbios? index ?	# PC keyboard/mouse controller
 #fdc*		at pnpbios? index ?	# floppy controller
-#npx*		at pnpbios? index ?	# Math coprocessor
 
 # IDE controller on Toshiba Portege 3000 series (crippled PCI device)
 #pciide* 	at pnpbios? index ?
@@ -525,12 +523,6 @@ cardslot*	at cbb?
 cardbus*	at cardslot?
 pcmcia* 	at cardslot?
 
-# Coprocessor Support
-
-# Math Coprocessor support
-npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
-
 # Console Devices
 
 # wscons

Index: src/sys/arch/i386/conf/GENERIC_PS2TINY
diff -u src/sys/arch/i386/conf/GENERIC_PS2TINY:1.70 src/sys/arch/i386/conf/GENERIC_PS2TINY:1.71
--- src/sys/arch/i386/conf/GENERIC_PS2TINY:1.70	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/i386/conf/GENERIC_PS2TINY	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC_PS2TINY,v 1.70 2013/06/30 21:38:57 rmind Exp $
+#	$NetBSD: GENERIC_PS2TINY,v 1.71 2014/01/26 19:16:16 dsl Exp $
 #
 #	GENERIC-style kernel config for IBM PS/2 with MCA bus. It only contains
 #	IBM PS/2 related stuff and has been generally trimmed down somewhat,
@@ -150,8 +150,6 @@ config		netbsd root on ? type ?
 mca0	at mainbus0
 isa0	at mainbus0
 
-#npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
 # wscons
 pckbc0		at isa?			# PC keyboard controller
 options 	PCKBCDEBUG

Index: src/sys/arch/i386/conf/GENERIC_TINY
diff -u src/sys/arch/i386/conf/GENERIC_TINY:1.136 src/sys/arch/i386/conf/GENERIC_TINY:1.137
--- src/sys/arch/i386/conf/GENERIC_TINY:1.136	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/i386/conf/GENERIC_TINY	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC_TINY,v 1.136 2013/06/30 21:38:57 rmind Exp $
+#	$NetBSD: GENERIC_TINY,v 1.137 2014/01/26 19:16:16 dsl Exp $
 #
 #	GENERIC_TINY -- suitable default for 4M machines
 #			No EISA, PCI, or SCSI.
@@ -231,11 +231,6 @@ pcic1	at isa? port 0x3e2 iomem 0xd4000 i
 # ISA Plug-and-Play PCMCIA controllers
 #pcic*	at isapnp?
 
-# Coprocessor Support
-
-# Math Coprocessor support
-npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
 # Console Devices
 
 # wscons

Index: src/sys/arch/i386/conf/INSTALL_FLOPPY
diff -u src/sys/arch/i386/conf/INSTALL_FLOPPY:1.21 src/sys/arch/i386/conf/INSTALL_FLOPPY:1.22
--- src/sys/arch/i386/conf/INSTALL_FLOPPY:1.21	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/i386/conf/INSTALL_FLOPPY	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_FLOPPY,v 1.21 2013/06/30 21:38:57 rmind Exp $
+#	$NetBSD: INSTALL_FLOPPY,v 1.22 2014/01/26 19:16:16 dsl Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -240,11 +240,6 @@ isapnp0 at isa?
 # ISA Plug-and-Play PCMCIA controllers
 pcic*	at isapnp?
 
-# Coprocessor Support
-
-# Math Coprocessor support
-npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
 
 # Console Devices
 

Index: src/sys/arch/i386/conf/INSTALL_TINY
diff -u src/sys/arch/i386/conf/INSTALL_TINY:1.138 src/sys/arch/i386/conf/INSTALL_TINY:1.139
--- src/sys/arch/i386/conf/INSTALL_TINY:1.138	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/i386/conf/INSTALL_TINY	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_TINY,v 1.138 2013/06/30 21:38:57 rmind Exp $
+#	$NetBSD: INSTALL_TINY,v 1.139 2014/01/26 19:16:16 dsl Exp $
 #
 #	This kernel should be derived from INSTALL (which is derived
 #	from GENERIC) with some features commented out.
@@ -221,11 +221,6 @@ isa0	at mainbus?
 # ISA Plug-and-Play bus support
 #isapnp0 at isa?
 
-# Coprocessor Support
-
-# Math Coprocessor support
-npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
 
 # Console Devices
 

Index: src/sys/arch/i386/conf/NET4501
diff -u src/sys/arch/i386/conf/NET4501:1.82 src/sys/arch/i386/conf/NET4501:1.83
--- src/sys/arch/i386/conf/NET4501:1.82	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/i386/conf/NET4501	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-# $NetBSD: NET4501,v 1.82 2013/06/30 21:38:57 rmind Exp $
+# $NetBSD: NET4501,v 1.83 2014/01/26 19:16:16 dsl Exp $
 #
 # NET4501 -- kernel configuration for a Soekris Engineering net4501
 # single-board computer.
@@ -10,7 +10,7 @@ include 	"arch/i386/conf/std.i386"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"NET4501-$Revision: 1.82 $"
+#ident 		"NET4501-$Revision: 1.83 $"
 
 maxusers	32		# estimated number of users
 
@@ -204,11 +204,6 @@ atw*	at cardbus? function ?	# ADMtek ADM
 ral*	at cardbus? function ?	# Ralink RT2x60 (802.11)
 rtw*	at cardbus? function ?	# Realtek RTL8180 (802.11)
 
-# Coprocessor Support
-
-# Math Coprocessor support
-npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor
-
 # ISA serial interfaces
 com0	at isa? port 0x3f8 irq 4	# Standard PC serial ports
 com1	at isa? port 0x2f8 irq 3

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.80 src/sys/arch/i386/conf/XEN3_DOM0:1.81
--- src/sys/arch/i386/conf/XEN3_DOM0:1.80	Wed Oct 23 17:26:08 2013
+++ src/sys/arch/i386/conf/XEN3_DOM0	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.80 2013/10/23 17:26:08 matt Exp $
+#	$NetBSD: XEN3_DOM0,v 1.81 2014/01/26 19:16:16 dsl Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -211,7 +211,6 @@ hypervisor*	at mainbus?		# Xen hyperviso
 
 vcpu*		at hypervisor?		# Xen virtual CPUs
 xenbus* 	at hypervisor?		# Xen virtual bus
-npx0		at hypervisor?		# x86 math coprocessor
 
 xencons*	at hypervisor?		# Xen virtual console
 #xennet* 	at hypervisor?		# Xen virtual network interface

Index: src/sys/arch/i386/conf/XEN3_DOMU
diff -u src/sys/arch/i386/conf/XEN3_DOMU:1.55 src/sys/arch/i386/conf/XEN3_DOMU:1.56
--- src/sys/arch/i386/conf/XEN3_DOMU:1.55	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/i386/conf/XEN3_DOMU	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.55 2013/06/30 21:38:57 rmind Exp $
+# $NetBSD: XEN3_DOMU,v 1.56 2014/01/26 19:16:16 dsl Exp $
 
 include 	"arch/xen/conf/std.xen"
 
@@ -181,8 +181,6 @@ hypervisor*	at mainbus?		# Xen hyperviso
 
 vcpu*		at hypervisor?		# Xen virtual CPUs
 
-npx0		at hypervisor?		# x86 math coprocessor
-
 xencons*	at hypervisor?		# Xen virtual console
 
 xenbus* 	at hypervisor?		# Xen virtual bus

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.371 src/sys/arch/i386/conf/files.i386:1.372
--- src/sys/arch/i386/conf/files.i386:1.371	Wed Jul 17 21:26:28 2013
+++ src/sys/arch/i386/conf/files.i386	Sun Jan 26 19:16:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.371 2013/07/17 21:26:28 soren Exp $
+#	$NetBSD: files.i386,v 1.372 2014/01/26 19:16:16 dsl Exp $
 #
 # new style config file for i386 architecture
 #
@@ -81,6 +81,7 @@ file	arch/i386/i386/mtrr_k6.c	mtrr
 file	arch/i386/i386/process_machdep.c
 file	arch/i386/i386/trap.c
 file	dev/cons.c
+file	arch/i386/isa/npx.c
 
 file	arch/i386/i386/mptramp.S	multiprocessor
 
@@ -250,13 +251,6 @@ device	ptcd: gpiobus
 attach	ptcd at isa
 file	dev/isa/ptcd.c			ptcd
 
-# Numeric Processing Extension; Math Co-processor
-device	npx
-file	arch/i386/isa/npx.c		npx needs-flag
-
-attach	npx at isa with npx_isa
-file	arch/i386/isa/npx_isa.c		npx_isa
-
 # PC Mice: Logitech-style and Microsoft-style
 device	lms: wsmousedev
 attach	lms at isa
@@ -444,10 +438,6 @@ include	"arch/i386/pnpbios/files.pnpbios
 include "dev/acpi/files.acpi"
 file	arch/i386/acpi/acpi_wakeup_low.S	acpi
 
-# Numeric Processing Extension; Math Co-processor
-attach	npx at acpinodebus with npx_acpi
-file	arch/i386/acpi/npx_acpi.c		npx_acpi
-
 # Obsolete vesabios/vesafb flags
 obsolete	defflag	opt_vesabios.h	VESABIOSVERBOSE
 obsolete	defparam opt_vesafb.h	VESAFB_WIDTH VESAFB_HEIGHT VESAFB_DEPTH

Index: src/sys/arch/i386/i386/autoconf.c
diff -u src/sys/arch/i386/i386/autoconf.c:1.98 src/sys/arch/i386/i386/autoconf.c:1.99
--- src/sys/arch/i386/i386/autoconf.c:1.98	Wed Oct  3 18:58:31 2012
+++ src/sys/arch/i386/i386/autoconf.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.98 2012/10/03 18:58:31 dsl Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.99 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.98 2012/10/03 18:58:31 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.99 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_intrdebug.h"
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <machine/intr.h>
 #include <machine/pcb.h>
 #include <machine/cpufunc.h>
+#include <machine/npx.h>
 
 #include "ioapic.h"
 #include "lapic.h"
@@ -118,6 +119,7 @@ cpu_configure(void)
 #if NIOAPIC > 0
 	ioapic_enable();
 #endif
+	fpuinit(&cpu_info_primary);
 	/* resync cr0 after FPU configuration */
 	pcb = lwp_getpcb(&lwp0);
 	pcb->pcb_cr0 = rcr0() & ~CR0_TS;

Index: src/sys/arch/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.1 src/sys/arch/i386/i386/i386_trap.S:1.2
--- src/sys/arch/i386/i386/i386_trap.S:1.1	Tue Jun 25 00:27:22 2013
+++ src/sys/arch/i386/i386/i386_trap.S	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.1 2013/06/25 00:27:22 uebayasi Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.2 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.1 2013/06/25 00:27:22 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.2 2014/01/26 19:16:17 dsl Exp $");
 #endif
 
 /*
@@ -156,7 +156,6 @@ IDTVEC(trap06)
 IDTVEC_END(trap06)
 #endif
 IDTVEC(trap07)
-#if NNPX > 0
 	pushl	$0			# dummy error code
 	pushl	$T_DNA
 	INTRENTRY
@@ -169,12 +168,6 @@ IDTVEC(trap07)
 	testl	%eax,%eax
 	jz	calltrap
 	jmp	_C_LABEL(trapreturn)
-#else
-#ifndef XEN
-	sti
-#endif
-	ZTRAP(T_DNA)
-#endif
 IDTVEC_END(trap07)
 IDTVEC(trap08)
 	TRAP(T_DOUBLEFLT)
@@ -234,7 +227,6 @@ IDTVEC_END(trap0f)
 IDTVEC_END(intrspurious)
 
 IDTVEC(trap10)
-#if NNPX > 0
 	/*
 	 * Handle like an interrupt so that we can call npxintr to clear the
 	 * error.  It would be better to handle npx interrupts as traps but
@@ -252,10 +244,6 @@ IDTVEC(trap10)
 	call	_C_LABEL(npxintr)
 	addl	$12,%esp
 	jmp	_C_LABEL(trapreturn)
-#else
-	sti
-	ZTRAP(T_ARITHTRAP)
-#endif
 IDTVEC_END(trap10)
 IDTVEC(trap11)
 	TRAP(T_ALIGNFLT)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.109 src/sys/arch/i386/i386/locore.S:1.110
--- src/sys/arch/i386/i386/locore.S:1.109	Sat Jan 11 17:05:17 2014
+++ src/sys/arch/i386/i386/locore.S	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.109 2014/01/11 17:05:17 christos Exp $	*/
+/*	$NetBSD: locore.S,v 1.110 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -129,7 +129,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.109 2014/01/11 17:05:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.110 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_ddb.h"
@@ -139,7 +139,6 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 #include "opt_vm86.h"
 #include "opt_xen.h"
 
-#include "npx.h"
 #include "assym.h"
 #include "lapic.h"
 #include "ioapic.h"
@@ -1288,41 +1287,10 @@ IDTVEC(svr4_fasttrap)
 	cli
 	jmp	2b
 
-#if NNPX > 0
-/*
- * Special interrupt handlers.  Someday intr0-intr15 will be used to count
- * interrupts.  We'll still need a special exception 16 handler.  The busy
- * latch stuff in probintr() can be moved to npxprobe().
- */
-
-/*
- * void probeintr(void)
- */
-NENTRY(probeintr)
-	ss
-	incl	_C_LABEL(npx_intrs_while_probing)
-	pushl	%eax
-	movb	$0x20,%al	# EOI (asm in strings loses cpp features)
-	outb	%al,$0xa0	# IO_ICU2
-	outb	%al,$0x20	# IO_ICU1
-	movb	$0,%al
-	outb	%al,$0xf0	# clear BUSY# latch
-	popl	%eax
-	iret
-END(probeintr)
-
-/*
- * void probetrap(void)
- */
-NENTRY(probetrap)
-	ss
-	incl	_C_LABEL(npx_traps_while_probing)
-	fnclex
-	iret
-END(probetrap)
-
 /*
  * int npx586bug1(int a, int b)
+ * Used when checking for the FDIV bug on first generations pentiums.
+ * Anything 120MHz or above is fine.
  */
 NENTRY(npx586bug1)
 	fildl	4(%esp)		# x
@@ -1336,7 +1304,6 @@ NENTRY(npx586bug1)
 	popl	%eax
 	ret
 END(npx586bug1)
-#endif /* NNPX > 0 */
 
 /*
  * void sse2_idlezero_page(void *pg)

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.742 src/sys/arch/i386/i386/machdep.c:1.743
--- src/sys/arch/i386/i386/machdep.c:1.742	Sun Jan 19 14:30:37 2014
+++ src/sys/arch/i386/i386/machdep.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.742 2014/01/19 14:30:37 dsl Exp $	*/
+/*	$NetBSD: machdep.c,v 1.743 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.742 2014/01/19 14:30:37 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.743 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -191,7 +191,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 
 #include "isa.h"
 #include "isadma.h"
-#include "npx.h"
 #include "ksyms.h"
 
 #include "cardbus.h"
@@ -869,12 +868,9 @@ setregs(struct lwp *l, struct exec_packa
 	struct trapframe *tf;
 	uint16_t control;
 
-#if NNPX > 0
 	/* If we were using the FPU, forget about it. */
-	if (pcb->pcb_fpcpu != NULL) {
-		npxsave_lwp(l, false);
-	}
-#endif
+	if (pcb->pcb_fpcpu != NULL)
+		fpusave_lwp(l, false);
 
 #ifdef USER_LDT
 	pmap_ldt_cleanup(l);
@@ -1641,16 +1637,13 @@ cpu_getmcontext(struct lwp *l, mcontext_
 	/* Save floating point register context, if any. */
 	if ((l->l_md.md_flags & MDL_USEDFPU) != 0) {
 		struct pcb *pcb = lwp_getpcb(l);
-#if NNPX > 0
 
 		/*
 		 * If this process is the current FP owner, dump its
 		 * context to the PCB first.
 		 */
-		if (pcb->pcb_fpcpu) {
-			npxsave_lwp(l, true);
-		}
-#endif
+		if (pcb->pcb_fpcpu)
+			fpusave_lwp(l, true);
 		if (i386_use_fxsave) {
 			memcpy(&mcp->__fpregs.__fp_reg_set.__fp_xmm_state.__fp_xmm,
 			    &pcb->pcb_savefpu.sv_xmm,
@@ -1742,14 +1735,11 @@ cpu_setmcontext(struct lwp *l, const mco
 	if ((flags & _UC_TLSBASE) != 0)
 		lwp_setprivate(l, (void *)(uintptr_t)mcp->_mc_tlsbase);
 
-#if NNPX > 0
 	/*
 	 * If we were using the FPU, forget that we were.
 	 */
-	if (pcb->pcb_fpcpu != NULL) {
-		npxsave_lwp(l, false);
-	}
-#endif
+	if (pcb->pcb_fpcpu != NULL)
+		fpusave_lwp(l, false);
 
 	/* Restore floating point register context, if any. */
 	if ((flags & _UC_FPU) != 0) {

Index: src/sys/arch/i386/i386/process_machdep.c
diff -u src/sys/arch/i386/i386/process_machdep.c:1.79 src/sys/arch/i386/i386/process_machdep.c:1.80
--- src/sys/arch/i386/i386/process_machdep.c:1.79	Sat Jan 25 20:12:53 2014
+++ src/sys/arch/i386/i386/process_machdep.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.79 2014/01/25 20:12:53 dsl Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.80 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -52,11 +52,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.79 2014/01/25 20:12:53 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.80 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_vm86.h"
 #include "opt_ptrace.h"
-#include "npx.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -250,9 +249,7 @@ process_read_fpregs(struct lwp *l, struc
 	union savefpu *frame = process_fpframe(l);
 
 	if (l->l_md.md_flags & MDL_USEDFPU) {
-#if NNPX > 0
-		npxsave_lwp(l, true);
-#endif
+		fpusave_lwp(l, true);
 	} else {
 		/*
 		 * Fake a FNINIT.
@@ -353,9 +350,7 @@ process_write_fpregs(struct lwp *l, cons
 	union savefpu *frame = process_fpframe(l);
 
 	if (l->l_md.md_flags & MDL_USEDFPU) {
-#if NNPX > 0
-		npxsave_lwp(l, false);
-#endif
+		fpusave_lwp(l, false);
 	} else {
 		l->l_md.md_flags |= MDL_USEDFPU;
 	}
@@ -404,13 +399,11 @@ process_machdep_read_xmmregs(struct lwp 
 		return (EINVAL);
 
 	if (l->l_md.md_flags & MDL_USEDFPU) {
-#if NNPX > 0
 		struct pcb *pcb = lwp_getpcb(l);
 
 		if (pcb->pcb_fpcpu != NULL) {
-			npxsave_lwp(l, true);
+			fpusave_lwp(l, true);
 		}
-#endif
 	} else {
 		/*
 		 * Fake a FNINIT.
@@ -443,14 +436,12 @@ process_machdep_write_xmmregs(struct lwp
 		return (EINVAL);
 
 	if (l->l_md.md_flags & MDL_USEDFPU) {
-#if NNPX > 0
 		struct pcb *pcb = lwp_getpcb(l);
 
 		/* If we were using the FPU, drop it. */
 		if (pcb->pcb_fpcpu != NULL) {
-			npxsave_lwp(l, false);
+			fpusave_lwp(l, false);
 		}
-#endif
 	} else {
 		l->l_md.md_flags |= MDL_USEDFPU;
 	}

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.268 src/sys/arch/i386/i386/trap.c:1.269
--- src/sys/arch/i386/i386/trap.c:1.268	Sun Jan 19 14:30:37 2014
+++ src/sys/arch/i386/i386/trap.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.268 2014/01/19 14:30:37 dsl Exp $	*/
+/*	$NetBSD: trap.c,v 1.269 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.268 2014/01/19 14:30:37 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.269 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -112,8 +112,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2
 
 #include <sys/kgdb.h>
 
-#include "npx.h"
-
 #ifdef KDTRACE_HOOKS
 #include <sys/dtrace_bsd.h>
 
@@ -586,11 +584,9 @@ kernelfault:
 		case T_DIVIDE|T_USER:
 			ksi.ksi_code = FPE_INTDIV;
 			break;
-#if NNPX > 0
 		case T_ARITHTRAP|T_USER:
 			ksi.ksi_code = npxtrap(l);
 			break;
-#endif
 		default:
 			ksi.ksi_code = 0;
 			break;

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.63 src/sys/arch/i386/i386/vector.S:1.64
--- src/sys/arch/i386/i386/vector.S:1.63	Fri Nov 22 01:09:11 2013
+++ src/sys/arch/i386/i386/vector.S	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.63 2013/11/22 01:09:11 riz Exp $	*/
+/*	$NetBSD: vector.S,v 1.64 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.63 2013/11/22 01:09:11 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.64 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -88,7 +88,6 @@ __KERNEL_RCSID(0, "$NetBSD: vector.S,v 1
 #include "ioapic.h"
 #include "lapic.h"
 
-#include "npx.h"
 #include "assym.h"
 
 /*

Index: src/sys/arch/i386/include/npx.h
diff -u src/sys/arch/i386/include/npx.h:1.31 src/sys/arch/i386/include/npx.h:1.32
--- src/sys/arch/i386/include/npx.h:1.31	Sat Jan 25 20:12:53 2014
+++ src/sys/arch/i386/include/npx.h	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npx.h,v 1.31 2014/01/25 20:12:53 dsl Exp $	*/
+/*	$NetBSD: npx.h,v 1.32 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -193,10 +193,8 @@ union savefpu {
 
 #ifdef _KERNEL
 
-void	probeintr(void);
-void	probetrap(void);
 int	npx586bug1(int, int);
-void 	npxinit(struct cpu_info *);
+void 	fpuinit(struct cpu_info *);
 void	process_xmm_to_s87(const struct fxsave *, struct save87 *);
 void	process_s87_to_xmm(const struct save87 *, struct fxsave *);
 struct lwp;

Index: src/sys/arch/i386/isa/npx.c
diff -u src/sys/arch/i386/isa/npx.c:1.148 src/sys/arch/i386/isa/npx.c:1.149
--- src/sys/arch/i386/isa/npx.c:1.148	Sun Jan 19 14:30:37 2014
+++ src/sys/arch/i386/isa/npx.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npx.c,v 1.148 2014/01/19 14:30:37 dsl Exp $	*/
+/*	$NetBSD: npx.c,v 1.149 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.148 2014/01/19 14:30:37 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.149 2014/01/26 19:16:17 dsl Exp $");
 
 #if 0
 #define IPRINTF(x)	printf x
@@ -111,33 +111,21 @@ __KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.14
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/cpu.h>
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/vmmeter.h>
 #include <sys/kernel.h>
-#include <sys/bus.h>
 #include <sys/cpu.h>
-#include <sys/intr.h>
-
-#include <uvm/uvm_extern.h>
 
 #include <machine/cpufunc.h>
 #include <machine/cpuvar.h>
 #include <machine/pcb.h>
-#include <machine/trap.h>
 #include <machine/specialreg.h>
-#include <machine/pio.h>
-#include <machine/i8259.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
 
-#include <i386/isa/npxvar.h>
 
 /*
- * 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
+ * 387 Numeric Coprocessor Extension (NPX) Driver.
+ *
+ * Note that we only support 486 and later cpus, these do not support
+ * an external fpu, only the one that is part of the cpu fabric.
+ * A 486 might not have an fpu, but the 487 is a full 486.
  *
  * We do lazy initialization and switching using the TS bit in cr0 and the
  * MDL_USEDFPU bit in mdlwp.
@@ -164,7 +152,6 @@ static int	npxdna(struct cpu_info *);
 #define	stts() HYPERVISOR_fpu_taskswitch(1)
 #endif
 
-static	enum npx_type		npx_type;
 volatile u_int			npx_intrs_while_probing;
 volatile u_int			npx_traps_while_probing;
 
@@ -187,172 +174,42 @@ fpu_save(union savefpu *addr)
 		fnsave(&addr->sv_87);
 }
 
-static int
-npxdna_empty(struct cpu_info *ci)
-{
-
-	panic("npxdna vector not initialized");
-	return 0;
-}
-
-
-int    (*npxdna_func)(struct cpu_info *) = npxdna_empty;
+int    (*npxdna_func)(struct cpu_info *) = npxdna;
 
-#ifndef XEN
-/*
- * This calls i8259_* directly, but currently we can count on systems
- * having a i8259 compatible setup all the time. Maybe have to change
- * that in the future.
- */
-enum npx_type
-npxprobe1(bus_space_tag_t iot, bus_space_handle_t ioh, int irq)
+void
+fpuinit(struct cpu_info *ci)
 {
-	struct gate_descriptor save_idt_npxintr;
-	struct gate_descriptor save_idt_npxtrap;
-	enum npx_type rv = NPX_NONE;
-	u_long	save_eflags;
-	int control;
-	int status;
-	unsigned irqmask;
-
-	if (cpu_feature[0] & CPUID_FPU) {
-		i386_fpu_exception = 1;
-		return NPX_CPUID;
-	}
-	save_eflags = x86_read_psl();
-	x86_disable_intr();
-	save_idt_npxintr = idt[NRSVIDT + irq];
-	save_idt_npxtrap = idt[16];
-	setgate(&idt[NRSVIDT + irq], probeintr, 0, SDT_SYS386IGT, SEL_KPL,
-	    GSEL(GCODE_SEL, SEL_KPL));
-	setgate(&idt[16], probetrap, 0, SDT_SYS386TGT, SEL_KPL,
-	    GSEL(GCODE_SEL, SEL_KPL));
-
-	irqmask = i8259_setmask(~((1 << IRQ_SLAVE) | (1 << irq)));
-
-	/*
-	 * Partially reset the coprocessor, if any.  Some BIOS's don't reset
-	 * it after a warm boot.
-	 */
-	/* full reset on some systems, NOP on others */
-	bus_space_write_1(iot, ioh, 1, 0);
-	delay(1000);
-	/* clear BUSY# latch */
-	bus_space_write_1(iot, ioh, 0, 0);
+	uint16_t control;
+	uint32_t cr0;
 
-	/*
-	 * We set CR0 in locore to trap all ESC and WAIT instructions.
-	 * We have to turn off the CR0_EM bit temporarily while probing.
-	 */
-	lcr0(rcr0() & ~(CR0_EM|CR0_TS));
-	x86_enable_intr();
-
-	/*
-	 * Finish resetting the coprocessor, if any.  If there is an error
-	 * pending, then we may get a bogus IRQ13, but probeintr() will handle
-	 * it OK.  Bogus halts have never been observed, but we enabled
-	 * IRQ13 and cleared the BUSY# latch early to handle them anyway.
-	 */
+	/* Assume we have an FPU */
+	cr0 = rcr0();
+	cr0 &= ~(CR0_EM | CR0_TS);
+	cr0 |= CR0_NE | CR0_MP;
+	lcr0(cr0);
+	/* Read back the default contol word */
 	fninit();
-	delay(1000);		/* wait for any IRQ13 (fwait might hang) */
+	fnstcw(&control);
 
-	/*
-	 * Check for a status of mostly zero.
-	 */
-	status = 0x5a5a;
-	fnstsw(&status);
-	if ((status & 0xb8ff) == 0) {
-		/*
-		 * Good, now check for a proper control word.
-		 */
-		control = 0x5a5a;
-		fnstcw(&control);
-		if ((control & 0x1f3f) == 0x033f) {
-			/*
-			 * We have an npx, now divide by 0 to see if exception
-			 * 16 works.
-			 */
-			control &= ~(1 << 2);	/* enable divide by 0 trap */
-			fldcw(&control);
-			npx_traps_while_probing = npx_intrs_while_probing = 0;
-			fp_divide_by_0();
-			if (npx_traps_while_probing != 0) {
-				/*
-				 * Good, exception 16 works.
-				 */
-				rv = NPX_EXCEPTION;
-				i386_fpu_exception = 1;
-			} else if (npx_intrs_while_probing != 0) {
-				/*
-				 * Bad, we are stuck with IRQ13.
-				 */
-				rv = NPX_INTERRUPT;
-			} else {
-				/*
-				 * Worse, even IRQ13 is broken.  Use emulator.
-				 */
-				rv = NPX_BROKEN;
-			}
-		}
+	if (control != __INITIAL_NPXCW__) {
+		/* Must be a 486SX, emulate FP instructions */
+		lcr0((cr0 & ~CR0_MP) | CR0_EM);
+		aprint_normal_dev(ci->ci_dev, "no fpu\n");
+		return;
 	}
 
-	x86_disable_intr();
-	lcr0(rcr0() | (CR0_EM|CR0_TS));
-
-	irqmask = i8259_setmask(irqmask);
-
-	idt[NRSVIDT + irq] = save_idt_npxintr;
-
-	idt[16] = save_idt_npxtrap;
-	x86_write_psl(save_eflags);
-
-	return (rv);
-}
+	/* We have a valid FPU */
+	i386_fpu_present = 1;
 
-void npxinit(struct cpu_info *ci)
-{
-	lcr0(rcr0() & ~(CR0_EM|CR0_TS));
-	fninit();
 	if (npx586bug1(4195835, 3145727) != 0) {
+		/* NB 120+MHz cpus are not affected */
 		i386_fpu_fdivbug = 1;
 		aprint_normal_dev(ci->ci_dev,
 		    "WARNING: Pentium FDIV bug detected!\n");
 	}
-	lcr0(rcr0() | (CR0_TS));
-}
-#endif
-
-/*
- * Common attach routine.
- */
-void
-npxattach(struct npx_softc *sc)
-{
-
-	npx_softc = sc;
-	npx_type = sc->sc_type;
-
-#ifndef XEN
-	npxinit(&cpu_info_primary);
-#endif
-	i386_fpu_present = 1;
-	npxdna_func = npxdna;
 
-	if (!pmf_device_register(sc->sc_dev, NULL, NULL))
-		aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n");
-}
-
-int
-npxdetach(device_t self, int flags)
-{
-	struct npx_softc *sc = device_private(self);
-
-	if (sc->sc_type == NPX_INTERRUPT)
-		return EBUSY;
-
-	pmf_device_deregister(self);
-	
-	return 0;
+	/* Set TS so first fp instruction faults */
+	lcr0(cr0 | CR0_TS);
 }
 
 /*
@@ -367,9 +224,10 @@ npxdetach(device_t self, int flags)
  * a status code!  So there is no way to have a non-naive SIGFPE handler.  At
  * best a handler could do an fninit followed by an fldcw of a static value.
  * fnclex would be of little use because it would leave junk on the FPU stack.
- * Returning from the handler would be even less safe than usual because
- * IRQ13 exception handling makes exceptions even less precise than usual.
+ *
+ * Only called dircetly from i386_trap.S
  */
+int npxintr(void *, struct intrframe *);
 int
 npxintr(void *arg, struct intrframe *frame)
 {
@@ -379,7 +237,6 @@ npxintr(void *arg, struct intrframe *fra
 	struct pcb *pcb;
 	ksiginfo_t ksi;
 
-
 	kpreempt_disable();
 #ifndef XEN
 	KASSERT((x86_read_psl() & PSL_I) == 0);
@@ -389,15 +246,6 @@ npxintr(void *arg, struct intrframe *fra
 	curcpu()->ci_data.cpu_ntrap++;
 	IPRINTF(("%s: fp intr\n", device_xname(ci->ci_dev)));
 
-#ifndef XEN
-	struct npx_softc *sc = npx_softc;
-	/*
-	 * Clear the interrupt latch.
-	 */
-	if (sc->sc_type == NPX_INTERRUPT)
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh, 0, 0);
-#endif
-
 	/*
 	 * If we're saving, ignore the interrupt.  The FPU will generate
 	 * another one when we restore the state later.
@@ -407,9 +255,9 @@ npxintr(void *arg, struct intrframe *fra
 		return (1);
 	}
 
-	if (l == NULL || npx_type == NPX_NONE) {
-		printf("npxintr: l = %p, curproc = %p, npx_type = %d\n",
-		    l, curproc, npx_type);
+	if (l == NULL || !i386_fpu_present) {
+		printf("npxintr: l = %p, curproc = %p, fpu_present = %d\n",
+		    l, curproc, i386_fpu_present);
 		printf("npxintr: came from nowhere");
 		kpreempt_enable();
 		return 1;
@@ -496,18 +344,7 @@ npxintr(void *arg, struct intrframe *fra
 
 		trapsignal(l, &ksi);
 	} else {
-		/*
-		 * This is a nested interrupt.  This should only happen when
-		 * an IRQ13 occurs at the same time as a higher-priority
-		 * interrupt.
-		 *
-		 * XXX
-		 * Currently, we treat this like an asynchronous interrupt, but
-		 * this has disadvantages.
-		 */
-		mutex_enter(proc_lock);
-		psignal(l->l_proc, SIGFPE);
-		mutex_exit(proc_lock);
+		panic("fpu trap from kernel\n");
 	}
 
 	kpreempt_enable();
@@ -582,7 +419,7 @@ npxdna(struct cpu_info *ci)
 			return 1;
 		}
 		KASSERT(fl != l);
-		npxsave_cpu(true);
+		fpusave_cpu(true);
 		KASSERT(ci->ci_fpcurlwp == NULL);
 	}
 
@@ -591,7 +428,7 @@ npxdna(struct cpu_info *ci)
 		/* Explicitly disable preemption before dropping spl. */
 		KPREEMPT_DISABLE(l);
 		splx(s);
-		npxsave_lwp(l, true);
+		fpusave_lwp(l, true);
 		KASSERT(pcb->pcb_fpcpu == NULL);
 		s = splhigh();
 		KPREEMPT_ENABLE(l);
@@ -649,7 +486,7 @@ npxdna(struct cpu_info *ci)
  * Save current CPU's FPU state.  Must be called at IPL_HIGH.
  */
 void
-npxsave_cpu(bool save)
+fpusave_cpu(bool save)
 {
 	struct cpu_info *ci;
 	struct lwp *l;
@@ -694,7 +531,7 @@ npxsave_cpu(bool save)
  * may race against it.
  */
 void
-npxsave_lwp(struct lwp *l, bool save)
+fpusave_lwp(struct lwp *l, bool save)
 {
 	struct cpu_info *oci;
 	struct pcb *pcb;
@@ -712,7 +549,7 @@ npxsave_lwp(struct lwp *l, bool save)
 		}
 		if (oci == curcpu()) {
 			KASSERT(oci->ci_fpcurlwp == l);
-			npxsave_cpu(save);
+			fpusave_cpu(save);
 			splx(s);
 			break;
 		}
@@ -731,7 +568,7 @@ npxsave_lwp(struct lwp *l, bool save)
 			spins++;
 		}
 		if (spins > 100000000) {
-			panic("npxsave_lwp: did not");
+			panic("fpusave_lwp: did not");
 		}
 	}
 
@@ -937,8 +774,8 @@ npxtrap(struct lwp *l)
 	struct lwp *fl = ci->ci_fpcurlwp;
 
 	if (!i386_fpu_present) {
-		printf("%s: fpcurthread = %p, curthread = %p, npx_type = %d\n",
-		    __func__, fl, l, npx_type);
+		printf("%s: fpcurthread = %p, curthread = %p\n",
+		    __func__, fl, l);
 		panic("npxtrap from nowhere");
 	}
 	kpreempt_disable();

Index: src/sys/arch/i386/pnpbios/files.pnpbios
diff -u src/sys/arch/i386/pnpbios/files.pnpbios:1.17 src/sys/arch/i386/pnpbios/files.pnpbios:1.18
--- src/sys/arch/i386/pnpbios/files.pnpbios:1.17	Sat Dec  9 22:45:26 2006
+++ src/sys/arch/i386/pnpbios/files.pnpbios	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-# $NetBSD: files.pnpbios,v 1.17 2006/12/09 22:45:26 uwe Exp $
+# $NetBSD: files.pnpbios,v 1.18 2014/01/26 19:16:17 dsl Exp $
 
 defflag  opt_pnpbios.h	PNPBIOSVERBOSE
 defflag  opt_pnpbios.h	PNPBIOSDEBUG
@@ -44,8 +44,5 @@ file	arch/i386/pnpbios/pckbc_pnpbios.c	p
 attach	fdc at pnpbios with fdc_pnpbios
 file	arch/i386/pnpbios/fdc_pnpbios.c		fdc_pnpbios
 
-attach	npx at pnpbios with npx_pnpbios
-file	arch/i386/pnpbios/npx_pnpbios.c		npx_pnpbios
-
 attach	joy at pnpbios with joy_pnpbios
 file	arch/i386/pnpbios/joy_pnpbios.c		joy_pnpbios

Index: src/sys/arch/x86/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.34 src/sys/arch/x86/acpi/acpi_wakeup.c:1.35
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.34	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.34 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.35 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.34 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.35 2014/01/26 19:16:17 dsl Exp $");
 
 /*-
  * Copyright (c) 2001 Takanori Watanabe <takaw...@jp.freebsd.org>
@@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.34 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.35 2014/01/26 19:16:17 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -268,12 +268,10 @@ acpi_cpu_sleep(struct cpu_info *ci)
 		return;
 
 	/* Execute Wakeup */
-#ifdef __i386__
-	npxinit(ci);
-#else
+#ifndef __i386__
 	cpu_init_msrs(ci, false);
-	fpuinit(ci);
 #endif
+	fpuinit(ci);
 #if NLAPIC > 0
 	lapic_enable();
 	lapic_set_lvt();
@@ -309,11 +307,7 @@ acpi_md_sleep(int state)
 	AcpiSetFirmwareWakingVector(acpi_wakeup_paddr);
 
 	s = splhigh();
-#ifdef __i386__
-	npxsave_cpu(true);
-#else
 	fpusave_cpu(true);
-#endif
 	x86_disable_intr();
 
 #ifdef MULTIPROCESSOR
@@ -329,12 +323,10 @@ acpi_md_sleep(int state)
 		goto out;
 
 	/* Execute Wakeup */
-#ifdef __i386__
-	npxinit(&cpu_info_primary);
-#else
+#ifndef __i386__
 	cpu_init_msrs(&cpu_info_primary, false);
-	fpuinit(&cpu_info_primary);
 #endif
+	fpuinit(&cpu_info_primary);
 	i8259_reinit();
 #if NLAPIC > 0
 	lapic_enable();

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.58 src/sys/arch/x86/include/cpu.h:1.59
--- src/sys/arch/x86/include/cpu.h:1.58	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/x86/include/cpu.h	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.58 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: cpu.h,v 1.59 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -426,8 +426,8 @@ void	i8254_initclocks(void);
 void	cpu_probe_features(struct cpu_info *);
 
 /* npx.c */
-void	npxsave_lwp(struct lwp *, bool);
-void	npxsave_cpu(bool);
+void	fpusave_lwp(struct lwp *, bool);
+void	fpusave_cpu(bool);
 
 /* vm_machdep.c */
 paddr_t	kvtop(void *);

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.107 src/sys/arch/x86/x86/cpu.c:1.108
--- src/sys/arch/x86/x86/cpu.c:1.107	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/x86/x86/cpu.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.107 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.108 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.107 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.108 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -72,10 +72,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10
 #include "lapic.h"
 #include "ioapic.h"
 
-#ifdef i386
-#include "npx.h"
-#endif
-
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
@@ -849,13 +845,7 @@ cpu_hatch(void *v)
 	lapic_set_lvt();
 	lapic_initclocks();
 
-#ifdef i386
-#if NNPX > 0
-	npxinit(ci);
-#endif
-#else
 	fpuinit(ci);
-#endif
 	lldt(GSYSSEL(GLDT_SEL, SEL_KPL));
 	ltr(ci->ci_tss_sel);
 
@@ -1123,13 +1113,7 @@ cpu_offline_md(void)
 	int s;
 
 	s = splhigh();
-#ifdef i386
-#if NNPX > 0
-	npxsave_cpu(true);
-#endif
-#else
 	fpusave_cpu(true);
-#endif
 	splx(s);
 }
 

Index: src/sys/arch/x86/x86/ipi.c
diff -u src/sys/arch/x86/x86/ipi.c:1.20 src/sys/arch/x86/x86/ipi.c:1.21
--- src/sys/arch/x86/x86/ipi.c:1.20	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/x86/x86/ipi.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipi.c,v 1.20 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: ipi.c,v 1.21 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.20 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.21 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_mtrr.h"
 
@@ -58,16 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.20
 
 #ifdef __x86_64__
 #include <machine/fpu.h>
-static void	x86_ipi_synch_fpu(struct cpu_info *);
-#else
-/* XXXfpu */
-#include "npx.h"
-#if NNPX > 0
-static void	x86_ipi_synch_fpu(struct cpu_info *);
-#define		fpusave_cpu(x)		npxsave_cpu(x)
-#else
-#define		x86_ipi_synch_fpu	NULL
-#endif
 #endif
 
 static void	x86_ipi_halt(struct cpu_info *);
@@ -86,6 +76,8 @@ void	acpi_cpu_sleep(struct cpu_info *);
 #define	acpi_cpu_sleep	NULL
 #endif
 
+static void	x86_ipi_synch_fpu(struct cpu_info *);
+
 void (*ipifunc[X86_NIPI])(struct cpu_info *) =
 {
 	x86_ipi_halt,
@@ -180,14 +172,12 @@ x86_ipi_halt(struct cpu_info *ci)
 	}
 }
 
-#if defined(__x86_64__) || NNPX > 0	/* XXXfpu */
 static void
 x86_ipi_synch_fpu(struct cpu_info *ci)
 {
 
 	fpusave_cpu(true);
 }
-#endif
 
 #ifdef MTRR
 static void

Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.19 src/sys/arch/x86/x86/vm_machdep.c:1.20
--- src/sys/arch/x86/x86/vm_machdep.c:1.19	Sat Jan 11 17:14:00 2014
+++ src/sys/arch/x86/x86/vm_machdep.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.19 2014/01/11 17:14:00 christos Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.20 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.19 2014/01/11 17:14:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.20 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_mtrr.h"
 
@@ -105,13 +105,6 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c
 
 #ifdef __x86_64__
 #include <machine/fpu.h>
-#else
-#include "npx.h"
-#if NNPX > 0
-#define fpusave_lwp(x, y)	npxsave_lwp(x, y)
-#else
-#define fpusave_lwp(x, y)
-#endif
 #endif
 
 void

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.129 src/sys/arch/xen/conf/files.xen:1.130
--- src/sys/arch/xen/conf/files.xen:1.129	Wed Oct  3 18:58:32 2012
+++ src/sys/arch/xen/conf/files.xen	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.129 2012/10/03 18:58:32 dsl Exp $
+#	$NetBSD: files.xen,v 1.130 2014/01/26 19:16:17 dsl Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -55,6 +55,8 @@ file	arch/i386/i386/process_machdep.c
 file	arch/i386/i386/trap.c
 file	arch/i386/i386/lock_stubs.S
 
+file	arch/i386/isa/npx.c
+
 
 file	arch/i386/i386/pmc.c			perfctrs
 
@@ -183,15 +185,6 @@ file arch/xen/xenbus/xenbus_dev.c xenbus
 file arch/xen/xenbus/xenbus_probe.c xenbus needs-flag
 file arch/xen/xenbus/xenbus_xs.c xenbus needs-flag
 
-ifdef i386
-# Numeric Processing Extension; Math Co-processor
-device	npx
-file	arch/i386/isa/npx.c		npx needs-flag
-
-attach	npx at xendevbus with npx_hv
-file	arch/xen/i386/npx_hv.c		npx_hv
-endif
-
 # Xen console support
 device	xencons: tty
 attach	xencons at xendevbus

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.95 src/sys/arch/xen/x86/cpu.c:1.96
--- src/sys/arch/xen/x86/cpu.c:1.95	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/xen/x86/cpu.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.95 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.96 2014/01/26 19:16:17 dsl Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.95 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.96 2014/01/26 19:16:17 dsl Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1059,11 +1059,7 @@ cpu_offline_md(void)
         int s;
 
         s = splhigh();
-#ifdef __i386__
-        npxsave_cpu(true);
-#else   
         fpusave_cpu(true);
-#endif
         splx(s);
 }
 

Index: src/sys/arch/xen/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.14 src/sys/arch/xen/x86/xen_ipi.c:1.15
--- src/sys/arch/xen/x86/xen_ipi.c:1.14	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/xen/x86/xen_ipi.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.14 2013/12/01 01:05:16 christos Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.15 2014/01/26 19:16:17 dsl Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.14 2013/12/01 01:05:16 christos Exp $"); 
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.15 2014/01/26 19:16:17 dsl Exp $"); 
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.14 2013/12/01 01:05:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.15 2014/01/26 19:16:17 dsl Exp $");
 
 #include <sys/types.h>
 
@@ -222,11 +222,7 @@ xen_ipi_synch_fpu(struct cpu_info *ci, s
 	KASSERT(ci != NULL);
 	KASSERT(intrf != NULL);
 
-#ifdef __x86_64__
 	fpusave_cpu(true);
-#else
-	npxsave_cpu(true);
-#endif /* __x86_64__ */
 }
 
 static void

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.62 src/sys/arch/xen/xen/hypervisor.c:1.63
--- src/sys/arch/xen/xen/hypervisor.c:1.62	Fri Apr  6 03:20:43 2012
+++ src/sys/arch/xen/xen/hypervisor.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.62 2012/04/06 03:20:43 riz Exp $ */
+/* $NetBSD: hypervisor.c,v 1.63 2014/01/26 19:16:17 dsl Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.62 2012/04/06 03:20:43 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.63 2014/01/26 19:16:17 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,11 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c
 
 #include "xenbus.h"
 #include "xencons.h"
-#ifndef __x86_64__
-#include "npx.h"
-#else
-#define NNPX 0
-#endif /* __x86_64__ */
 #include "isa.h"
 #include "pci.h"
 #include "acpica.h"
@@ -143,9 +138,6 @@ union hypervisor_attach_cookie {
 #if NXBD_HYPERVISOR > 0
 	struct xbd_attach_args hac_xbd;
 #endif
-#if NNPX > 0
-	struct xen_npx_attach_args hac_xennpx;
-#endif
 #if NPCI > 0
 	struct pcibus_attach_args hac_pba;
 #if defined(DOM0OPS) && NISA > 0
@@ -264,11 +256,6 @@ hypervisor_attach(device_t parent, devic
 	hac.hac_xencons.xa_device = "xencons";
 	config_found_ia(self, "xendevbus", &hac.hac_xencons, hypervisor_print);
 #endif
-#if NNPX > 0
-	memset(&hac, 0, sizeof(hac));
-	hac.hac_xennpx.xa_device = "npx";
-	config_found_ia(self, "xendevbus", &hac.hac_xennpx, hypervisor_print);
-#endif
 #ifdef DOM0OPS
 #if NPCI > 0
 #if NACPICA > 0

Index: src/sys/compat/linux/arch/i386/linux_machdep.c
diff -u src/sys/compat/linux/arch/i386/linux_machdep.c:1.155 src/sys/compat/linux/arch/i386/linux_machdep.c:1.156
--- src/sys/compat/linux/arch/i386/linux_machdep.c:1.155	Sun Jan 19 14:30:38 2014
+++ src/sys/compat/linux/arch/i386/linux_machdep.c	Sun Jan 26 19:16:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.155 2014/01/19 14:30:38 dsl Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.156 2014/01/26 19:16:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.155 2014/01/19 14:30:38 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.156 2014/01/26 19:16:17 dsl Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -129,11 +129,10 @@ linux_setregs(struct lwp *l, struct exec
 	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf;
 
-#if NNPX > 0
 	/* If we were using the FPU, forget about it. */
-	if (npxproc == l)
-		npxdrop();
-#endif
+	if (pcb->pcb_fpcpu != NULL)
+		fpusave_lwp(l, false);
+
 
 #ifdef USER_LDT
 	pmap_ldt_cleanup(l);

Reply via email to