Module Name:    src
Committed By:   maya
Date:           Sun Aug 20 09:47:14 UTC 2017

Modified Files:
        src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
use meaningful name for errata hack, dedup


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/mips/mips/mipsX_subr.S

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/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.103 src/sys/arch/mips/mips/mipsX_subr.S:1.104
--- src/sys/arch/mips/mips/mipsX_subr.S:1.103	Sun Aug 20 09:21:54 2017
+++ src/sys/arch/mips/mips/mipsX_subr.S	Sun Aug 20 09:47:13 2017
@@ -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 @@ NESTED_NOPROFILE(MIPSX(user_reserved_ins
 	/*
 	 * 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 @@ NESTED_NOPROFILE(MIPSX(user_gen_exceptio
 	/*
 	 * 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 @@ NESTED_NOPROFILE(MIPSX(user_intr), CALLF
  * 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 @@ NESTED_NOPROFILE(MIPSX(systemcall), CALL
 	/*
 	 * 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

Reply via email to