Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips Clear the BTB on user->kernel entry on Lo...



details:   https://anonhg.NetBSD.org/src/rev/764189243883
branches:  trunk
changeset: 767871:764189243883
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Aug 02 05:13:21 2011 +0000

description:
Clear the BTB on user->kernel entry on Loongson2

diffstat:

 sys/arch/mips/mips/mipsX_subr.S |  34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diffs (132 lines):

diff -r 4acc1f66517b -r 764189243883 sys/arch/mips/mips/mipsX_subr.S
--- a/sys/arch/mips/mips/mipsX_subr.S   Tue Aug 02 05:12:32 2011 +0000
+++ b/sys/arch/mips/mips/mipsX_subr.S   Tue Aug 02 05:13:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mipsX_subr.S,v 1.51 2011/07/31 15:39:29 matt Exp $     */
+/*     $NetBSD: mipsX_subr.S,v 1.52 2011/08/02 05:13:21 matt Exp $     */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -1052,6 +1052,10 @@
        /*
         * Save all the registers except the kernel temporaries onto the stack.
         */
+#ifdef MIPS3_LOONGSON2
+       li      k0, MIPS_DIAG_BTB_CLEAR
+       mtc0    k0, MIPS_COP_0_DIAG
+#endif
        /* K1 already has CURLWP */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1163,6 +1167,10 @@
  * Save the relevant user registers onto the kernel stack.
  * We don't need to save s0 - s8 because the compiler does it for us.
  */
+#ifdef MIPS3_LOONGSON2
+       li      k0, MIPS_DIAG_BTB_CLEAR
+       mtc0    k0, MIPS_COP_0_DIAG
+#endif
        /* k1 contains curlwp */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1333,6 +1341,10 @@
        /*
         * Save all the registers but kernel temporaries onto the stack.
         */
+#ifdef MIPS3_LOONGSON2
+       li      k0, MIPS_DIAG_BTB_CLEAR
+       mtc0    k0, MIPS_COP_0_DIAG
+#endif
        /* k1 already contains cpulwp */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1642,7 +1654,7 @@
        tlbwi                                   # write TLB
        COP0_SYNC
 #ifdef MIPS3_LOONGSON2
-       li      k0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    k0, MIPS_COP_0_DIAG             # invalidate ITLB
 #elif defined(MIPS3)
        nop
@@ -1677,7 +1689,7 @@
        tlbwi                                   # update TLB
        COP0_SYNC
 #ifdef MIPS3_LOONGSON2
-       li      k0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    k0, MIPS_COP_0_DIAG             # invalidate ITLB
 #elif defined(MIPS3)
        nop
@@ -1762,7 +1774,7 @@
        tlbwi                                   # update slot found
        COP0_SYNC
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #elif defined(MIPS3)
        nop                                     # required for QED5230
@@ -1784,7 +1796,7 @@
        tlbwi                                   # update slot found
        COP0_SYNC
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #elif defined(MIPS3)
        nop                                     # required for QED5230
@@ -1905,7 +1917,7 @@
        tlbwi
        COP0_SYNC
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #elif defined(MIPS3)
        nop
@@ -1975,7 +1987,7 @@
        COP0_SYNC
 
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #endif
 
@@ -2030,7 +2042,7 @@
        COP0_SYNC
 
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #endif
 
@@ -2078,7 +2090,7 @@
        COP0_SYNC
 
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #endif
 
@@ -2241,7 +2253,7 @@
        _MTC0   ta1, MIPS_COP_0_TLB_HI          # restore EntryHi
 
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #endif
 
@@ -2475,7 +2487,7 @@
        COP0_SYNC
 
 #ifdef MIPS3_LOONGSON2
-       li      v0, 4                           # ugly
+       li      k0, MIPS_DIAG_ITLB_CLEAR
        mtc0    v0, MIPS_COP_0_DIAG             # invalidate ITLB
 #endif
 



Home | Main Index | Thread Index | Old Index