Skip to contentSkip to conversation

Patch for PA 2.0, 32-bit kernels on systems with > 2GB RAM

parisc-linux Ryan Bradetich 1 participant 1 message Mar 28, 2002

lore
Share & tools
lore
#0 lore raw

Hello parisc-linux hackers,

The 2.4.18-pa6 patch broke 32-bit kernel on PA 2.0 systems if the system has > 2GB RAM. This patch fixes the problem for my C200+ with > 2GB RAM, and continues to boots with < 2GB RAM.

The basic problem was that the kernel was performing simple sign extension instead of F-Extension.

I plan on committing this patch into CVS in a couple of days unless it causes problems on someones configuration. Please test and let me know if you encounter problems.

Thanks,

- Ryan

P.S. Thanks to Thomas Bogendoerfer for helping to identify the cause, and to LaMont Jones for providing the assembly instructions to fix the problem without using a branch instruction :)

Index: arch/parisc/kernel/entry.S
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/entry.S,v retrieving revision 1.91

parisc/kernel/entry.S +20 -14
diff -u -p -r1.91 entry.S
@@ -1352,12 +1352,10 @@ dtlb_miss_20:
 
 	/* Get rid of prot bits and convert to page addr for idtlbt */
 
-	/* FIXME - sign extension of 0xf0... range is incorrect!
-	** extrd,s below needs to "f-extend" to "0xf0f0f0...".
-	** 4 instances of this to fix.
-	*/
-
+	extrd,s         pte,35,4,t0
 	depdi		0,63,12,pte	/* clear lower 12 bits */
+        addi,=          1,t0,0 
+        extrd,u,*tr     pte,56,25,pte 
 	extrd,s		pte,56,25,pte	/* bit 31:8 >> 8  */ 
 	idtlbt          pte,prot
 
@@ -1424,9 +1422,12 @@ nadtlb_miss_20:
 
 	/* Get rid of prot bits and convert to page addr for idtlbt */
 
-	depdi		0,63,12,pte	/* clear lower 12 bits */
-	extrd,s		pte,56,25,pte	/* bit 31:8 >> 8  */ 
-	idtlbt          pte,prot
+        extrd,s         pte,35,4,t0
+        depdi           0,63,12,pte     /* clear lower 12 bits */
+        addi,=          1,t0,0
+        extrd,u,*tr     pte,56,25,pte
+        extrd,s         pte,56,25,pte   /* bit 31:8 >> 8  */
+        idtlbt          pte,prot
 
 	rfir
 	nop
@@ -1674,8 +1675,11 @@ itlb_miss_common_20:
 
 	/* Get rid of prot bits and convert to page addr for iitlbt */
 
-	depdi		0,63,12,pte	/* clear lower 12 bits */
-	extrd,s		pte,56,25,pte	/* bit 31:8 >> 8  */ 
+        extrd,s         pte,35,4,t0 
+        depdi           0,63,12,pte     /* clear lower 12 bits */
+        addi,=          1,t0,0
+        extrd,u,*tr     pte,56,25,pte 
+        extrd,s         pte,56,25,pte   /* bit 31:8 >> 8  */
 	iitlbt          pte,prot
 
 	rfir
@@ -1889,11 +1893,13 @@ dbit_nolock_20:
 	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
 	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
 
-	/* Get rid of prot bits and convert to page addr for idtlbt */
+        extrd,s         pte,35,4,t0 
+        depdi           0,63,12,pte     /* clear lower 12 bits */
+        addi,=          1,t0,0
+        extrd,u,*tr     pte,56,25,pte 
+        extrd,s         pte,56,25,pte   /* bit 31:8 >> 8  */
+        idtlbt          pte,prot
 
-	depdi		0,63,12,pte	/* clear lower 12 bits */
-	extrd,s		pte,56,25,pte	/* bit 31:8 >> 8  */ 
-	idtlbt          pte,prot
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nounlock_20
 	ldi             1,t1