From 24238eeeaf65eb48cfdd188b94ba120d61e5e928 Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Sun, 11 Dec 2022 05:07:26 +0000 Subject: Cut two cycles from k_tlb_inv() on octeon. "If it works, go for it!" miod@ --- sys/arch/mips64/include/mips_cpu.h | 3 ++- sys/arch/mips64/mips64/tlbhandler.S | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/arch/mips64/include/mips_cpu.h b/sys/arch/mips64/include/mips_cpu.h index 9e3522b38f6..65bc90ac5f4 100644 --- a/sys/arch/mips64/include/mips_cpu.h +++ b/sys/arch/mips64/include/mips_cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mips_cpu.h,v 1.10 2021/05/01 16:11:11 visa Exp $ */ +/* $OpenBSD: mips_cpu.h,v 1.11 2022/12/11 05:07:25 visa Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -98,6 +98,7 @@ */ #define CR_BR_DELAY 0x80000000 +#define CR_BR_DELAY_SHIFT 31 #define CR_EXC_CODE 0x0000007c #define CR_EXC_CODE_SHIFT 2 #define CR_COP_ERR 0x30000000 diff --git a/sys/arch/mips64/mips64/tlbhandler.S b/sys/arch/mips64/mips64/tlbhandler.S index ceca1a20a49..baa41204a9e 100644 --- a/sys/arch/mips64/mips64/tlbhandler.S +++ b/sys/arch/mips64/mips64/tlbhandler.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tlbhandler.S,v 1.53 2021/10/07 13:08:17 visa Exp $ */ +/* $OpenBSD: tlbhandler.S,v 1.54 2022/12/11 05:07:25 visa Exp $ */ /* * Copyright (c) 1995-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -140,16 +140,16 @@ go_u_general: NLEAF(k_tlb_inv, 0) .set noat #ifdef CPU_OCTEON + .set push + .set arch=octeon /* Check if the fault was caused by an instruction fetch. */ dmfc0 k0, COP_0_CAUSE_REG - /* XXX bbit0 k0, CR_BR_DELAY_BIT, 1f */ - li k1, CR_BR_DELAY - and k0, k0, k1 - beq k0, zero, 1f # fault in a branch delay slot? + bbit0 k0, CR_BR_DELAY_SHIFT, 1f # fault in a branch delay slot? dmfc0 k1, COP_0_EXC_PC daddu k1, k1, 4 # adjust for the slot 1: dmfc0 k0, COP_0_BAD_VADDR beq k0, k1, go_k_general + .set pop #else dmfc0 k0, COP_0_BAD_VADDR # get the fault address #endif -- cgit v1.2.3