spoiler alert: we can dedup a lot more
> @@ -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
> - mtc0k0, 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
> - mtc0k0, 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
> - mtc0k0, 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
> - mtc0k0, 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
>