Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2002 20:43:36 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 17823 for review
Message-ID:  <200209210343.g8L3haZt011232@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17823

Change 17823 by peter@peter_daintree on 2002/09/20 20:42:55

	deconditionalize npx before folding it in elsewhere.

Affected files ...

.. //depot/projects/hammer/sys/x86_64/isa/npx.c#8 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/exception.s#5 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#10 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/swtch.s#3 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/trap.c#8 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/vm_machdep.c#4 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/isa/npx.c#8 (text+ko) ====

@@ -37,7 +37,6 @@
 
 #include "opt_debug_npx.h"
 #include "opt_isa.h"
-#include "opt_npx.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>

==== //depot/projects/hammer/sys/x86_64/x86_64/exception.s#5 (text+ko) ====

@@ -34,8 +34,6 @@
  * $FreeBSD: src/sys/i386/i386/exception.s,v 1.98 2002/07/28 00:27:51 peter Exp $
  */
 
-#include "opt_npx.h"
-
 #include <machine/asmacros.h>
 #include <sys/mutex.h>
 #include <machine/psl.h>

==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#10 (text+ko) ====

@@ -47,7 +47,6 @@
 #include "opt_isa.h"
 #include "opt_maxmem.h"
 #include "opt_msgbuf.h"
-#include "opt_npx.h"
 #include "opt_perfmon.h"
 #include "opt_kstack_pages.h"
 
@@ -1668,10 +1667,6 @@
 static void
 get_fpcontext(struct thread *td, mcontext_t *mcp)
 {
-#ifndef DEV_NPX
-	mcp->mc_fpformat = _MC_FPFMT_NODEV;
-	mcp->mc_ownedfp = _MC_FPOWNED_NONE;
-#else
 	union savefpu *addr;
 
 	/*
@@ -1699,7 +1694,6 @@
 		bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	}
 	mcp->mc_fpformat = npxformat();
-#endif
 }
 
 static int
@@ -1726,13 +1720,11 @@
 			while ((uintptr_t)(void *)addr & 0xF);
 			bcopy(&mcp->mc_fpstate, addr, sizeof(mcp->mc_fpstate));
 		}
-#ifdef DEV_NPX
 		/*
 		 * XXX we violate the dubious requirement that npxsetregs()
 		 * be called with interrupts disabled.
 		 */
 		npxsetregs(td, addr);
-#endif
 		/*
 		 * Don't bother putting things back where they were in the
 		 * misaligned case, since we know that the caller won't use
@@ -1749,10 +1741,8 @@
 	register_t s;
 
 	s = intr_disable();
-#ifdef DEV_NPX
 	if (PCPU_GET(fpcurthread) == td)
 		npxdrop();
-#endif
 	/*
 	 * XXX force a full drop of the npx.  The above only drops it if we
 	 * owned it.  npxgetregs() has the same bug in the !cpu_fxsr case.

==== //depot/projects/hammer/sys/x86_64/x86_64/swtch.s#3 (text+ko) ====

@@ -36,8 +36,6 @@
  * $FreeBSD: src/sys/i386/i386/swtch.s,v 1.134 2002/07/21 05:22:16 peter Exp $
  */
 
-#include "opt_npx.h"
-
 #include <machine/asmacros.h>
 
 #ifdef SMP
@@ -129,7 +127,6 @@
 	/* XXX FIXME: we should be saving the local APIC TPR */
 #endif
 
-#ifdef DEV_NPX
 	/* have we used fp, and need a save? */
 	cmpl	%ecx,PCPU(FPCURTHREAD)
 	jne	1f
@@ -138,7 +135,6 @@
 	call	npxsave				/* do it in a big C function */
 	popl	%eax
 1:
-#endif
 
 	/* Save is done.  Now choose a new thread. */
 	/* XXX still trashing space above the old "Top Of Stack". */
@@ -340,7 +336,6 @@
 	pushfl
 	popl	PCB_PSL(%ecx)
 
-#ifdef DEV_NPX
 	/*
 	 * If fpcurthread == NULL, then the npx h/w state is irrelevant and the
 	 * state had better already be in the pcb.  This is true for forks
@@ -377,6 +372,5 @@
 	addl	$12,%esp
 1:
 	popfl
-#endif	/* DEV_NPX */
 
 	ret

==== //depot/projects/hammer/sys/x86_64/x86_64/trap.c#8 (text+ko) ====

@@ -47,7 +47,6 @@
 #include "opt_ddb.h"
 #include "opt_isa.h"
 #include "opt_ktrace.h"
-#include "opt_npx.h"
 #include "opt_trap.h"
 
 #include <sys/param.h>
@@ -281,13 +280,9 @@
 			break;
 
 		case T_ARITHTRAP:	/* arithmetic trap */
-#ifdef DEV_NPX
 			ucode = npxtrap();
 			if (ucode == -1)
 				goto userout;
-#else
-			ucode = code;
-#endif
 			i = SIGFPE;
 			break;
 
@@ -362,11 +357,9 @@
 			break;
 
 		case T_DNA:
-#ifdef DEV_NPX
 			/* transparent fault (due to context switch "late") */
 			if (npxdna())
 				goto userout;
-#endif
 			i = SIGFPE;
 			ucode = FPE_FPU_NP_TRAP;
 			break;
@@ -392,15 +385,15 @@
 			goto out;
 
 		case T_DNA:
-#ifdef DEV_NPX
 			/*
 			 * The kernel is apparently using npx for copying.
 			 * XXX this should be fatal unless the kernel has
 			 * registered such use.
 			 */
-			if (npxdna())
+			if (npxdna()) {
+				printf("npxdna in kernel mode!\n");
 				goto out;
-#endif
+			}
 			break;
 
 		case T_STKFLT:		/* stack fault */

==== //depot/projects/hammer/sys/x86_64/x86_64/vm_machdep.c#4 (text+ko) ====

@@ -41,7 +41,6 @@
  * $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.192 2002/09/16 19:25:08 mini Exp $
  */
 
-#include "opt_npx.h"
 #include "opt_reset.h"
 #include "opt_isa.h"
 #include "opt_kstack_pages.h"
@@ -119,9 +118,7 @@
 	register struct proc *p1;
 	struct pcb *pcb2;
 	struct mdproc *mdp2;
-#ifdef DEV_NPX
 	register_t savecrit;
-#endif
 
 	p1 = td1->td_proc;
 	if ((flags & RFPROC) == 0) {
@@ -142,14 +139,12 @@
 	}
 
 	/* Ensure that p1's pcb is up to date. */
-#ifdef DEV_NPX
 	if (td1 == curthread)
 		td1->td_pcb->pcb_gs = rgs();
 	savecrit = intr_disable();
 	if (PCPU_GET(fpcurthread) == td1)
 		npxsave(&td1->td_pcb->pcb_save);
 	intr_restore(savecrit);
-#endif
 
 	/* Point the pcb to the top of the stack */
 	pcb2 = (struct pcb *)(td2->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
@@ -260,9 +255,8 @@
 cpu_thread_exit(struct thread *td)
 {
 	struct pcb *pcb = td->td_pcb; 
-#ifdef DEV_NPX
+
 	npxexit(td);
-#endif
 	if (pcb->pcb_ext != 0) {
 		/* XXXKSE  XXXSMP  not SMP SAFE.. what locks do we have? */
 		/* if (pcb->pcb_ext->ext_refcount-- == 1) ?? */

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209210343.g8L3haZt011232>