Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2001 11:51:57 +0200
From:      Tor.Egge@fast.no
To:        bde@zeta.org.au
Cc:        juriy@aviaport.ru, freebsd-current@FreeBSD.ORG, peter@FreeBSD.ORG
Subject:   Re: kernel with SSE is unstable
Message-ID:  <200107170951.LAA72393@midten.fast.no>
In-Reply-To: Your message of "Mon, 16 Jul 2001 20:35:13 %2B1000 (EST)"
References:  <Pine.BSF.4.21.0107162017400.58001-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Tue_Jul_17_11:46:48_2001)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


> Good.
> 
> I want all use of the cpu number removed.  It seems to be just to avoid
> alignment problems that shouldn't happen in practice (the save area
> should always be suitably aligned if it isn't already, and I think it
> is already).

The pcb_save area has the proper alignment but the dummy variable used
in npxinit might not have the proper alignment when on the stack.

The enclosed patch should be a step in the right direction.

- Tor Egge


----Next_Part(Tue_Jul_17_11:46:48_2001)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Index: sys/i386/isa/npx.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/npx.c,v
retrieving revision 1.105
diff -u -r1.105 npx.c
--- sys/i386/isa/npx.c	2001/07/16 06:00:23	1.105
+++ sys/i386/isa/npx.c	2001/07/16 16:54:13
@@ -564,7 +564,7 @@
 npxinit(control)
 	u_short control;
 {
-	union savefpu dummy;
+	static union savefpu dummy;
 	critical_t savecrit;
 
 	if (!npx_exists)
@@ -926,30 +926,21 @@
 fpusave(addr)
 	union savefpu *addr;
 {
-	static struct savexmm svxmm[MAXCPU];
-	u_char oncpu = PCPU_GET(cpuid);
 	
 	if (!cpu_fxsr)
 		fnsave(addr);
-	else {
-		fxsave(&svxmm[oncpu]);
-		bcopy(&svxmm[oncpu], addr, sizeof(struct savexmm));
-	}
+	else
+		fxsave(addr);
 }
 
 static void
 fpurstor(addr)
 	union savefpu *addr;
 {
-	static struct savexmm svxmm[MAXCPU];
-	u_char oncpu = PCPU_GET(cpuid);
-
 	if (!cpu_fxsr)
 		frstor(addr);
-	else {
-		bcopy(addr, &svxmm[oncpu], sizeof (struct savexmm));
-		fxrstor(&svxmm[oncpu]);
-	}
+	else
+		fxrstor(addr);
 }
 
 #ifdef I586_CPU_XXX

----Next_Part(Tue_Jul_17_11:46:48_2001)----

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




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