patch-2.4.25 linux-2.4.25/arch/mips64/mm/tlbex-r4k.S

Next file: linux-2.4.25/arch/parisc/config.in
Previous file: linux-2.4.25/arch/mips64/mm/tlb-sb1.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/arch/mips64/mm/tlbex-r4k.S linux-2.4.25/arch/mips64/mm/tlbex-r4k.S
@@ -10,13 +10,20 @@
 #include <linux/config.h>
 #include <linux/init.h>
 #include <linux/threads.h>
+
 #include <asm/asm.h>
+#include <asm/hazards.h>
 #include <asm/regdef.h>
 #include <asm/mipsregs.h>
 #include <asm/pgtable.h>
 #include <asm/stackframe.h>
 #include <asm/war.h>
 
+#define PGD_INDX_MASK	((_PTRS_PER_PGD - 1) << _PGD_T_LOG2)
+#define PMD_INDX_MASK	((_PTRS_PER_PMD - 1) << _PMD_T_LOG2)
+#define PTE_INDX_MASK	((_PTRS_PER_PTE - 1) << _PTE_T_LOG2)
+#define PTEP_INDX_MASK	((_PTRS_PER_PTE >> 1 - 1) << (_PTE_T_LOG2 + 1))
+
 	.data
 	.comm	pgd_current, NR_CPUS * 8, 8
 
@@ -35,17 +42,17 @@
 #endif
 	bltz	\tmp, \kaddr
 	 ld	\ptr, (\ptr)
-	dsrl	\tmp, (PGDIR_SHIFT-3)		# get pgd offset in bytes
-	andi	\tmp, ((PTRS_PER_PGD - 1)<<3)
+	dsrl	\tmp, PGDIR_SHIFT - 3		# get pgd offset in bytes
+	andi	\tmp, PGD_INDX_MASK
 	daddu	\ptr, \tmp			# add in pgd offset
 	dmfc0	\tmp, CP0_BADVADDR
 	ld	\ptr, (\ptr)			# get pmd pointer
-	dsrl	\tmp, (PMD_SHIFT-3)		# get pmd offset in bytes
-	andi	\tmp, ((PTRS_PER_PMD - 1)<<3)
+	dsrl	\tmp, PMD_SHIFT - 3		# get pmd offset in bytes
+	andi	\tmp, PMD_INDX_MASK
 	daddu	\ptr, \tmp			# add in pmd offset
 	dmfc0	\tmp, CP0_XCONTEXT
 	ld	\ptr, (\ptr)			# get pte pointer
-	andi	\tmp, 0xff0			# get pte offset
+	andi	\tmp, PTEP_INDX_MASK		# get pte offset
 	daddu	\ptr, \tmp
 	.endm
 
@@ -65,7 +72,7 @@
 	 */
 	dsubu	\tmp, \tmp, \ptr
 	dla	\ptr, kptbl
-	dsrl	\tmp, (PAGE_SHIFT+1)		# get vpn2
+	dsrl	\tmp, _PAGE_SHIFT + 1		# get vpn2
 	dsll	\tmp, 4				# byte offset of pte
 	daddu	\ptr, \ptr, \tmp
 
@@ -123,7 +130,7 @@
 	dmfc0	k0, CP0_BADVADDR
 	dmfc0	k1, CP0_ENTRYHI
 	xor	k0, k1
-	dsrl	k0, k0, PAGE_SHIFT+1
+	dsrl	k0, k0, _PAGE_SHIFT + 1
 	bnez	k0, 1f
 #endif
 	.set    noat
@@ -144,9 +151,11 @@
 	ld	k0, 0(k1)			# get even pte
 	ld	k1, 8(k1)			# get odd pte
 	PTE_RELOAD k0 k1
+	rm9000_tlb_hazard
 	b	1f
 	 tlbwr
 1:	nop
+	rm9000_tlb_hazard
 	eret
 
 9:						# handle the vmalloc range
@@ -154,9 +163,11 @@
 	ld	k0, 0(k1)			# get even pte
 	ld	k1, 8(k1)			# get odd pte
 	PTE_RELOAD k0 k1
+	rm9000_tlb_hazard
 	b	1f
 	 tlbwr
 1:	nop
+	rm9000_tlb_hazard
 	eret
 END(handle_vec1_r4k)
 
@@ -184,8 +195,10 @@
 	ld	k0, 0(k1)			# get even pte
 	ld	k1, 8(k1)			# get odd pte
 	PTE_RELOAD k0 k1
+	rm9000_tlb_hazard
 	nop
 	tlbwr
+	rm9000_tlb_hazard
 	eret
 
 9:						# handle the vmalloc range
@@ -193,8 +206,10 @@
 	ld	k0, 0(k1)			# get even pte
 	ld	k1, 8(k1)			# get odd pte
 	PTE_RELOAD k0 k1
+	rm9000_tlb_hazard
 	nop
 	tlbwr
+	rm9000_tlb_hazard
 	eret
 END(handle_vec1_r10k)
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)