No need to load function addresses in registers and branch to the register
authormiod <miod@openbsd.org>
Fri, 24 Nov 2023 07:57:39 +0000 (07:57 +0000)
committermiod <miod@openbsd.org>
Fri, 24 Nov 2023 07:57:39 +0000 (07:57 +0000)
contents when there is that nifty instruction called "call"; NFC

sys/arch/riscv64/riscv64/cpuswitch.S
sys/arch/riscv64/riscv64/exception.S

index 7562600..da5424d 100644 (file)
@@ -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 <drahn@dalerahn.com>
@@ -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
index c9eb9b3..9a53200 100644 (file)
@@ -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 <br@bsdpad.com>
 
        /* handle the ast */
        mv      a0, sp
-       la      t0, ast
-       jalr    t0
+       call    ast
        j       1b
 2:
 .endm