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 use meaningful name for errata hack, dedup



details:   https://anonhg.NetBSD.org/src/rev/d0849cf8668e
branches:  trunk
changeset: 826187:d0849cf8668e
user:      maya <maya%NetBSD.org@localhost>
date:      Sun Aug 20 09:47:13 2017 +0000

description:
use meaningful name for errata hack, dedup

diffstat:

 sys/arch/mips/mips/mipsX_subr.S |  29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diffs (71 lines):

diff -r c8fb1683069a -r d0849cf8668e sys/arch/mips/mips/mipsX_subr.S
--- a/sys/arch/mips/mips/mipsX_subr.S   Sun Aug 20 09:21:54 2017 +0000
+++ b/sys/arch/mips/mips/mipsX_subr.S   Sun Aug 20 09:47:13 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mipsX_subr.S,v 1.103 2017/08/20 09:21:54 maya Exp $    */
+/*     $NetBSD: mipsX_subr.S,v 1.104 2017/08/20 09:47:13 maya Exp $    */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -150,6 +150,13 @@
        li reg, MIPS_SR_EXL | MIPS_SR_KX; mtc0 reg, MIPS_COP_0_STATUS
 #endif
 
+#ifdef MIPS3_LOONGSON2
+#define KERN_ENTRY_ERRATA \
+       li k0, MIPS_DIAG_BTB_CLEAR|MIPS_DIAG_RAS_DISABLE; mtc0 k0, MIPS_COP_0_DIAG
+#else
+#define KERN_ENTRY_ERRATA /* nothing */
+#endif
+
 #if MIPS1
 #error This file can not be compiled with MIPS1 defined
 #endif
@@ -1288,10 +1295,7 @@
        /*
         * Save a minimum of registers to see if this is rdhwr $3,$29
         */
-#ifdef MIPS3_LOONGSON2
-       li      k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-       mtc0    k0, MIPS_COP_0_DIAG
-#endif
+       KERN_ENTRY_ERRATA
        /* K1 already has CURLWP */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1353,10 +1357,7 @@
        /*
         * Save all the registers except the kernel temporaries onto the stack.
         */
-#ifdef MIPS3_LOONGSON2
-       li      k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-       mtc0    k0, MIPS_COP_0_DIAG
-#endif
+       KERN_ENTRY_ERRATA
        /* K1 already has CURLWP */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1468,10 +1469,7 @@
  * 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 | MIPS_DIAG_RAS_DISABLE
-       mtc0    k0, MIPS_COP_0_DIAG
-#endif
+       KERN_ENTRY_ERRATA
        /* k1 contains curlwp */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1660,10 +1658,7 @@
        /*
         * Save all the registers but kernel temporaries onto the stack.
         */
-#ifdef MIPS3_LOONGSON2
-       li      k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-       mtc0    k0, MIPS_COP_0_DIAG
-#endif
+       KERN_ENTRY_ERRATA
        /* k1 already contains cpulwp */
        PTR_L   k0, L_PCB(k1)                   # XXXuvm_lwp_getuarea
        PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ



Home | Main Index | Thread Index | Old Index