patch-2.1.44 linux/include/asm-sparc64/system.h

Next file: linux/include/asm-sparc64/uaccess.h
Previous file: linux/include/asm-sparc64/string.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.43/linux/include/asm-sparc64/system.h linux/include/asm-sparc64/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.22 1997/06/01 10:27:28 davem Exp $ */
+/* $Id: system.h,v 1.26 1997/06/28 10:04:03 davem Exp $ */
 #ifndef __SPARC64_SYSTEM_H
 #define __SPARC64_SYSTEM_H
 
@@ -95,45 +95,15 @@
 {
 	__asm__ __volatile__("
 		rdpr		%%otherwin, %%g1
-		brz,pt		%%g1, 2f
+		brz,pt		%%g1, 1f
+		 mov		%%o7, %%g3
+		call		__flushw_user
 		 clr		%%g2
-1:
-		save		%%sp, %0, %%sp
-		rdpr		%%otherwin, %%g1
-		brnz,pt		%%g1, 1b
-		 add		%%g2, 1, %%g2
-1:
-		subcc		%%g2, 1, %%g2
-		bne,pt		%%xcc, 1b
-		 restore	%%g0, %%g0, %%g0
-2:
-	" : : "i" (-REGWIN_SZ)
-	  : "g1", "g2", "cc");
+1:"	: : : "g1", "g2", "g3");
 }
 
 #define flush_user_windows flushw_user
 
-#ifdef __SMP__
-
-#include <asm/fpumacro.h>
-
-#define SWITCH_ENTER(prev)						\
-	if((prev)->flags & PF_USEDFPU) { 				\
-		fprs_write(FPRS_FEF);					\
-		fpsave((unsigned long *) &(prev)->tss.float_regs[0],	\
-		       &(prev)->tss.fsr);				\
-		(prev)->flags &= ~PF_USEDFPU;				\
-		(prev)->tss.kregs->tstate &= ~TSTATE_PEF;		\
-	}
-
-#define SWITCH_DO_LAZY_FPU(next)
-#else
-#define SWITCH_ENTER(prev)
-#define SWITCH_DO_LAZY_FPU(next)			\
-	if(last_task_used_math != (next))		\
-		(next)->tss.kregs->tstate &= ~TSTATE_PEF
-#endif
-
 	/* See what happens when you design the chip correctly?
 	 * NOTE NOTE NOTE this is extremely non-trivial what I
 	 * am doing here.  GCC needs only one register to stuff
@@ -146,13 +116,13 @@
 do {											\
 	__label__ switch_continue;							\
 	register unsigned long task_pc asm("o7");					\
-	SWITCH_ENTER(prev)								\
-	SWITCH_DO_LAZY_FPU(next);							\
+	(prev)->tss.kregs->fprs = 0;							\
 	task_pc = ((unsigned long) &&switch_continue) - 0x8;				\
 	__asm__ __volatile__(								\
 	"rdpr	%%pstate, %%g2\n\t"							\
-	"wrpr	%%g2, 0x2, %%pstate\n\t"						\
+	"wrpr	%%g2, 0x3, %%pstate\n\t"						\
 	"flushw\n\t"									\
+/*XXX*/	"wr	%%g0, 0, %%fprs\n\t"							\
 	"stx	%%i6, [%%sp + 2047 + 0x70]\n\t"						\
 	"stx	%%i7, [%%sp + 2047 + 0x78]\n\t"						\
 	"rdpr	%%wstate, %%o5\n\t"							\
@@ -160,19 +130,20 @@
 	"stx	%%o5, [%%g6 + %2]\n\t"							\
 	"rdpr	%%cwp, %%o5\n\t"							\
 	"stx	%%o7, [%%g6 + %4]\n\t"							\
-	"stx	%%o5, [%%g6 + %5]\n\t"							\
+	"st	%%o5, [%%g6 + %5]\n\t"							\
 	"mov	%0, %%g6\n\t"								\
-	"ldx	[%0 + %5], %%g1\n\t"							\
-	"wr	%0, 0x0, %%pic\n\t"							\
+	"ld	[%0 + %5], %%g1\n\t"							\
 	"wrpr	%%g1, %%cwp\n\t"							\
 	"ldx	[%%g6 + %2], %%o5\n\t"							\
 	"ldx	[%%g6 + %3], %%o6\n\t"							\
 	"ldx	[%%g6 + %4], %%o7\n\t"							\
+	"mov	%%g6, %0\n\t"								\
 	"wrpr	%%o5, 0x0, %%wstate\n\t"						\
 	"ldx	[%%sp + 2047 + 0x70], %%i6\n\t"						\
 	"ldx	[%%sp + 2047 + 0x78], %%i7\n\t"						\
+	"wrpr	%%g0, 0x96, %%pstate\n\t"						\
 	"jmpl	%%o7 + 0x8, %%g0\n\t"							\
-	" wrpr	%%g2, 0x0, %%pstate\n\t"						\
+	" mov	%0, %%g6\n\t"								\
 	: /* No outputs */								\
 	: "r" (next), "r" (task_pc),							\
 	  "i" ((const unsigned long)(&((struct task_struct *)0)->tss.wstate)),		\
@@ -200,15 +171,15 @@
 {
 	unsigned long temp;
 	__asm__ __volatile__("
-	ldx		[%3], %1
-1:
+	mov		%0, %%g1
+1:	ldx		[%3], %1
 	casx		[%3], %1, %0
 	cmp		%1, %0
 	bne,a,pn	%%xcc, 1b
-	 ldx		[%3], %1
+	 mov		%%g1, %0
 "	: "=&r" (val), "=&r" (temp)
 	: "0" (val), "r" (m)
-	: "cc");
+	: "g1", "cc");
 	return val;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov