From: jca Date: Fri, 2 Dec 2022 12:27:08 +0000 (+0000) Subject: Drop _C_LABEL() uses in riscv64-specific code X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=96b95d32ce3c7d277e4eaf75cbe677111530b951;p=openbsd Drop _C_LABEL() uses in riscv64-specific code _C_LABEL() was useful in the a.out->ELF transition days, way before RISC-V was a thing. Also drop uses of _ASM_LABEL() while here, suggested by guenther@ ok guenther@ --- diff --git a/lib/libc/arch/riscv64/SYS.h b/lib/libc/arch/riscv64/SYS.h index 7c1e59a6593..ad2fdf3f59d 100644 --- a/lib/libc/arch/riscv64/SYS.h +++ b/lib/libc/arch/riscv64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.3 2021/05/04 04:26:00 drahn Exp $ */ +/* $OpenBSD: SYS.h,v 1.4 2022/12/02 12:27:08 jca Exp $ */ /*- * Copyright (c) 2020 Brian Bamsch * Copyright (c) 1990 The Regents of the University of California. @@ -44,8 +44,8 @@ #define TP_OFFSET_ERRNO TCB_OFFSET_ERRNO #define SYSENTRY(x) \ - .weak _C_LABEL(x); \ - _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x); \ + .weak x; \ + x = _thread_sys_ ## x; \ ENTRY(_thread_sys_ ## x) #define SYSENTRY_HIDDEN(x) \ ENTRY(_thread_sys_ ## x) diff --git a/lib/libc/arch/riscv64/sys/brk.S b/lib/libc/arch/riscv64/sys/brk.S index d84e1b5bcd6..f1d75878177 100644 --- a/lib/libc/arch/riscv64/sys/brk.S +++ b/lib/libc/arch/riscv64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.2 2021/10/25 14:38:10 jca Exp $ */ +/* $OpenBSD: brk.S,v 1.3 2022/12/02 12:27:08 jca Exp $ */ /* * Copyright (c) 2021 Dale Rahn * @@ -18,24 +18,24 @@ #include "SYS.h" .extern __curbrk - .extern _C_LABEL(_end) + .extern _end .data .align 3 __minbrk: - .dword _C_LABEL(_end) + .dword _end ENTRY(brk) RETGUARD_SETUP(brk, t6) - lla t1, _C_LABEL(__minbrk) + lla t1, __minbrk ld t5, 0(t1) bgeu a0, t5, .L_brk_call mv a0, t5 .L_brk_call: mv a2, a0 - lla t1, _C_LABEL(__curbrk) + lla t1, __curbrk li t0, SYS_break ecall diff --git a/lib/libc/arch/riscv64/sys/sbrk.S b/lib/libc/arch/riscv64/sys/sbrk.S index a58effc3232..40b6f0acb5a 100644 --- a/lib/libc/arch/riscv64/sys/sbrk.S +++ b/lib/libc/arch/riscv64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.2 2021/10/25 14:38:10 jca Exp $ */ +/* $OpenBSD: sbrk.S,v 1.3 2022/12/02 12:27:08 jca Exp $ */ /* * Copyright (c) 2021 Dale Rahn * @@ -17,7 +17,7 @@ #include "SYS.h" - .extern _C_LABEL(_end) + .extern _end .data .align 3 @@ -25,13 +25,13 @@ .hidden __curbrk .type __curbrk,@object __curbrk: - .dword _C_LABEL(_end) + .dword _end END(__curbrk) ENTRY(sbrk) RETGUARD_SETUP(sbrk, t6) - lla t1, _C_LABEL(__curbrk) + lla t1, __curbrk ld a2, 0(t1) add a0, a0, a2 // compute current break mv t3, a0 diff --git a/sys/arch/riscv64/include/asm.h b/sys/arch/riscv64/include/asm.h index b9d78f527ff..a26c4737580 100644 --- a/sys/arch/riscv64/include/asm.h +++ b/sys/arch/riscv64/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.5 2022/08/30 16:26:29 miod Exp $ */ +/* $OpenBSD: asm.h,v 1.6 2022/12/02 12:27:08 jca Exp $ */ /* * Copyright (c) 2020 Brian Bamsch @@ -83,10 +83,10 @@ #define _ENTRY(x) \ .text; .globl x; .type x,@function; .p2align 1; x: -#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE -#define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) -#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE -#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y)) +#define ENTRY(y) _ENTRY(y); _PROF_PROLOGUE +#define ENTRY_NP(y) _ENTRY(y) +#define ASENTRY(y) _ENTRY(y); _PROF_PROLOGUE +#define ASENTRY_NP(y) _ENTRY(y) #define END(y) .size y, . - y #define EENTRY(sym) .globl sym; sym: #define EEND(sym) diff --git a/sys/arch/riscv64/riscv64/cpuswitch.S b/sys/arch/riscv64/riscv64/cpuswitch.S index ea5fa634a4c..c6a58b89dad 100644 --- a/sys/arch/riscv64/riscv64/cpuswitch.S +++ b/sys/arch/riscv64/riscv64/cpuswitch.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpuswitch.S,v 1.6 2022/02/22 07:47:46 visa Exp $ */ +/* $OpenBSD: cpuswitch.S,v 1.7 2022/12/02 12:27:08 jca Exp $ */ /* * Copyright (c) 2015 Dale Rahn @@ -93,7 +93,7 @@ END(cpu_switch_asm) ENTRY(proc_trampoline) #ifdef MULTIPROCESSOR - la t0, _C_LABEL(proc_trampoline_mp) + la t0, proc_trampoline_mp jalr t0 #endif // call it or just set the variable? diff --git a/sys/arch/riscv64/riscv64/exception.S b/sys/arch/riscv64/riscv64/exception.S index bc92e22f9ba..1fe16a33c4d 100644 --- a/sys/arch/riscv64/riscv64/exception.S +++ b/sys/arch/riscv64/riscv64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.5 2021/05/20 04:22:33 drahn Exp $ */ +/* $OpenBSD: exception.S,v 1.6 2022/12/02 12:27:08 jca Exp $ */ /*- * Copyright (c) 2015-2018 Ruslan Bukin @@ -202,7 +202,7 @@ /* handle the ast */ mv a0, sp - la t0, _C_LABEL(ast) + la t0, ast jalr t0 j 1b 2: @@ -222,7 +222,7 @@ END(cpu_exception_handler) ENTRY(cpu_exception_handler_supervisor) save_registers 1 mv a0, sp - call _C_LABEL(do_trap_supervisor) + call do_trap_supervisor restore_registers 1 sret END(cpu_exception_handler_supervisor) @@ -230,7 +230,7 @@ END(cpu_exception_handler_supervisor) ENTRY(cpu_exception_handler_user) save_registers 0 mv a0, sp - call _C_LABEL(do_trap_user) + call do_trap_user do_ast restore_registers 0 csrrw sp, sscratch, sp diff --git a/sys/arch/riscv64/riscv64/locore.S b/sys/arch/riscv64/riscv64/locore.S index f454768b481..8848ac3bdf1 100644 --- a/sys/arch/riscv64/riscv64/locore.S +++ b/sys/arch/riscv64/riscv64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.14 2022/01/02 03:41:08 jsg Exp $ */ +/* $OpenBSD: locore.S,v 1.15 2022/12/02 12:27:08 jca Exp $ */ /*- * Copyright (c) 2015-2018 Ruslan Bukin @@ -185,8 +185,8 @@ va: andi sp, sp, ~STACKALIGNBYTES /* Clear BSS */ - la t0, _C_LABEL(__bss_start) - la t1, _C_LABEL(_end) + la t0, __bss_start + la t1, _end 1: sd zero, 0(t0) addi t0, t0, 8 @@ -216,8 +216,8 @@ va: sd t1, 0(t0) mv a0, sp - call _C_LABEL(initriscv) /* Off we go */ - call _C_LABEL(main) + call initriscv /* Off we go */ + call main /* * Get the physical address the kernel is loaded to. Returned in s9. @@ -252,19 +252,19 @@ ENTRY(sigcode) li t0, SYS_sigreturn ecall - .globl _C_LABEL(sigcoderet) -_C_LABEL(sigcoderet): + .globl sigcoderet +sigcoderet: /* sigreturn failed, exit */ li t0, SYS_exit ecall END(sigcode) - .globl _C_LABEL(esigcode) -_C_LABEL(esigcode): + .globl esigcode +esigcode: .data - .global _C_LABEL(esym) -_C_LABEL(esym): - .quad _C_LABEL(end) + .global esym +esym: + .quad end .align 12 pagetable_l1: @@ -333,6 +333,6 @@ mpva: csrw satp, a2 sfence.vma - call _C_LABEL(cpu_start_secondary) + call cpu_start_secondary #endif