From 429a74cfadd7b27c83537f8f86c15b7f27a31999 Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 24 Nov 2023 07:57:39 +0000 Subject: [PATCH] No need to load function addresses in registers and branch to the register contents when there is that nifty instruction called "call"; NFC --- sys/arch/riscv64/riscv64/cpuswitch.S | 8 +++----- sys/arch/riscv64/riscv64/exception.S | 5 ++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/arch/riscv64/riscv64/cpuswitch.S b/sys/arch/riscv64/riscv64/cpuswitch.S index 75626003e3c..da5424d1f73 100644 --- a/sys/arch/riscv64/riscv64/cpuswitch.S +++ b/sys/arch/riscv64/riscv64/cpuswitch.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpuswitch.S,v 1.8 2023/10/24 13:20:10 claudio Exp $ */ +/* $OpenBSD: cpuswitch.S,v 1.9 2023/11/24 07:57:39 miod Exp $ */ /* * Copyright (c) 2015 Dale Rahn @@ -65,8 +65,7 @@ ENTRY(cpu_switchto_asm) ld s1, PCB_SP(a5) // load new stack pointer mv a0, a1 - la t0, pmap_set_satp - jalr t0 + call pmap_set_satp mv a7, s0 // move retguard random mv sp, s1 // restore stack pointer @@ -92,8 +91,7 @@ ENTRY(cpu_switchto_asm) END(cpu_switch_asm) ENTRY(proc_trampoline) - la t0, proc_trampoline_mi - jalr t0 + call proc_trampoline_mi mv a0, s2 jalr s1 la t0, syscall_return diff --git a/sys/arch/riscv64/riscv64/exception.S b/sys/arch/riscv64/riscv64/exception.S index c9eb9b3467c..9a53200e248 100644 --- a/sys/arch/riscv64/riscv64/exception.S +++ b/sys/arch/riscv64/riscv64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.7 2023/11/20 16:10:37 miod Exp $ */ +/* $OpenBSD: exception.S,v 1.8 2023/11/24 07:57:39 miod Exp $ */ /*- * Copyright (c) 2015-2018 Ruslan Bukin @@ -202,8 +202,7 @@ /* handle the ast */ mv a0, sp - la t0, ast - jalr t0 + call ast j 1b 2: .endm -- 2.20.1