Module Name: src
Committed By: matt
Date: Wed Dec 29 00:33:33 UTC 2010
Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpuregs.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap_tlb.c
Log Message:
Add MIPS_TLB_PID mask and use it apporpriately.
To generate a diff of this commit:
cvs rdiff -u -r1.74.28.18 -r1.74.28.19 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/arch/mips/mips/pmap_tlb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.74.28.18 src/sys/arch/mips/include/cpuregs.h:1.74.28.19
--- src/sys/arch/mips/include/cpuregs.h:1.74.28.18 Tue Apr 27 05:44:30 2010
+++ src/sys/arch/mips/include/cpuregs.h Wed Dec 29 00:33:32 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuregs.h,v 1.74.28.18 2010/04/27 05:44:30 cliff Exp $ */
+/* $NetBSD: cpuregs.h,v 1.74.28.19 2010/12/29 00:33:32 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -713,12 +713,14 @@
#if !(defined(MIPS3) || defined(MIPS4) || defined(MIPS32) || defined(MIPS64)) \
&& defined(MIPS1) /* XXX simonb must be neater! */
#define MIPS_TLB_PID_SHIFT MIPS1_TLB_PID_SHIFT
+#define MIPS_TLB_PID MIPS1_TLB_PID
#define MIPS_TLB_NUM_PIDS MIPS1_TLB_NUM_PIDS
#endif
#if (defined(MIPS3) || defined(MIPS4) || defined(MIPS32) || defined(MIPS64)) \
&& !defined(MIPS1) /* XXX simonb must be neater! */
#define MIPS_TLB_PID_SHIFT 0
+#define MIPS_TLB_PID MIPS3_TLB_PID
#define MIPS_TLB_NUM_PIDS MIPS3_TLB_NUM_ASIDS
#endif
@@ -727,6 +729,9 @@
#define MIPS_TLB_PID_SHIFT \
((MIPS_HAS_R4K_MMU) ? 0 : MIPS1_TLB_PID_SHIFT)
+#define MIPS_TLB_PID \
+ ((MIPS_HAS_R4K_MMU) ? MIPS3_TLB_PID : MIPS1_TLB_PID)
+
#define MIPS_TLB_NUM_PIDS \
((MIPS_HAS_R4K_MMU) ? MIPS3_TLB_NUM_ASIDS : MIPS1_TLB_NUM_PIDS)
#endif
Index: src/sys/arch/mips/mips/pmap_tlb.c
diff -u src/sys/arch/mips/mips/pmap_tlb.c:1.1.2.14 src/sys/arch/mips/mips/pmap_tlb.c:1.1.2.15
--- src/sys/arch/mips/mips/pmap_tlb.c:1.1.2.14 Fri Dec 24 07:09:53 2010
+++ src/sys/arch/mips/mips/pmap_tlb.c Wed Dec 29 00:33:32 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_tlb.c,v 1.1.2.14 2010/12/24 07:09:53 matt Exp $ */
+/* $NetBSD: pmap_tlb.c,v 1.1.2.15 2010/12/29 00:33:32 matt Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.1.2.14 2010/12/24 07:09:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.1.2.15 2010/12/29 00:33:32 matt Exp $");
/*
* Manages address spaces in a TLB.
@@ -1008,10 +1008,11 @@
pmap_tlb_asid_check(void)
{
#ifdef DEBUG
- register_t tlb_hi;
+ uint32_t tlb_hi;
__asm("mfc0 %0,$%1" : "=r"(tlb_hi) : "n"(MIPS_COP_0_TLB_HI));
- KASSERTMSG((tlb_hi & 0xff) != curcpu()->ci_pmap_asid_cur,
- ("tlb_hi (%#x) asid != current asid (%#x)",
- (uint8_t)tlb_hi, curcpu()->ci_pmap_asid_cur));
+ uint32_t asid = (tlb_hi & MIPS_TLB_PID) >> MIPS_TLB_PID_SHIFT;
+ KASSERTMSG(asid != curcpu()->ci_pmap_asid_cur,
+ ("tlb_hi (%#x) asid (%#x) != current asid (%#x)",
+ tlb_hi, asid, curcpu()->ci_pmap_asid_cur));
#endif
}