patch-2.1.127 linux/include/asm-sparc64/psrcompat.h

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

diff -u --recursive --new-file v2.1.126/linux/include/asm-sparc64/psrcompat.h linux/include/asm-sparc64/psrcompat.h
@@ -1,4 +1,4 @@
-/* $Id: psrcompat.h,v 1.4 1997/06/20 11:54:39 davem Exp $ */
+/* $Id: psrcompat.h,v 1.5 1998/10/06 09:28:39 jj Exp $ */
 #ifndef _SPARC64_PSRCOMPAT_H
 #define _SPARC64_PSRCOMPAT_H
 
@@ -21,21 +21,24 @@
 #define PSR_VERS    0x0f000000         /* cpu-version field          */
 #define PSR_IMPL    0xf0000000         /* cpu-implementation field   */
 
+#define PSR_V8PLUS  0xff000000         /* fake impl/ver, meaning a 64bit CPU is present */
+#define PSR_XCC	    0x000f0000         /* if PSR_V8PLUS, this is %xcc */
+
 extern inline unsigned int tstate_to_psr(unsigned long tstate)
 {
-	unsigned long vers;
-
-	__asm__ __volatile__("rdpr	%%ver, %0" : "=r" (vers));
 	return ((tstate & TSTATE_CWP)			|
 		PSR_S					|
 		((tstate & TSTATE_ICC) >> 12)		|
-		(((vers << 8) >> 32) & PSR_IMPL)	|
-		(((vers << 24) >> 36) & PSR_VERS));
+		((tstate & TSTATE_XCC) >> 20)		|
+		PSR_V8PLUS);
 }
 
 extern inline unsigned long psr_to_tstate_icc(unsigned int psr)
 {
-	return ((unsigned long)(psr & PSR_ICC)) << 12;
+	unsigned long tstate = ((unsigned long)(psr & PSR_ICC)) << 12;
+	if ((psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS)
+		tstate |= ((unsigned long)(psr & PSR_XCC)) << 20;
+	return tstate;
 }
 
 #endif /* !(_SPARC64_PSRCOMPAT_H) */

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