Move CALLSYS_NOERROR macro from <machine/asm.h> to libc, and expand it for
authormiod <miod@openbsd.org>
Wed, 6 Dec 2023 06:15:33 +0000 (06:15 +0000)
committermiod <miod@openbsd.org>
Wed, 6 Dec 2023 06:15:33 +0000 (06:15 +0000)
non-libc users. This is a two-liner macro anyway, and this will make
deraadt@'s future changes in this area easier to make. NFC

lib/libc/arch/alpha/SYS.h
libexec/ld.so/alpha/SYS.h
sys/arch/alpha/alpha/locore.s
sys/arch/alpha/include/asm.h

index a7f505b..688864b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: SYS.h,v 1.15 2016/05/16 16:25:06 guenther Exp $       */
+/*     $OpenBSD: SYS.h,v 1.16 2023/12/06 06:15:33 miod Exp $   */
 /*     $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $      */
 
 /*
@@ -65,6 +65,9 @@
                        _END(_HIDDEN(x))
 #define        END_WEAK(x)     END_STRONG(x); .weak x
 
+#define        CALLSYS_NOERROR(name)                                   \
+       ldiq    v0, ___CONCAT(SYS_,name);                       \
+       call_pal PAL_OSF1_callsys
 
 #define        CALLSYS_ERROR(name)                                     \
        CALLSYS_NOERROR(name);                                  \
index 004fe5f..4472afa 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: SYS.h,v 1.2 2019/02/03 02:20:36 guenther Exp $ */
+/*     $OpenBSD: SYS.h,v 1.3 2023/12/06 06:15:33 miod Exp $ */
 
 /*
  * Copyright (c) 2001 Niklas Hallqvist
@@ -63,7 +63,8 @@
 
 #define        DL_SYSCALL(c)                                                   \
 LEAF_NOPROFILE(_dl_##c, irrelevant);                                   \
-       CALLSYS_NOERROR(c);                                             \
+       ldiq    v0, SYS_##c;                                            \
+       call_pal PAL_OSF1_callsys;                                      \
        beq     a3, 1f;                                                 \
        subq    zero, v0, v0;   /* return -errno */                     \
 1:                                                                     \
index 959a6d0..1bbf06a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.52 2023/10/24 13:20:09 claudio Exp $ */
+/* $OpenBSD: locore.s,v 1.53 2023/12/06 06:15:33 miod Exp $ */
 /* $NetBSD: locore.s,v 1.94 2001/04/26 03:10:44 ross Exp $ */
 
 /*-
@@ -201,11 +201,13 @@ NESTED(sigcode,0,0,ra,0,0)
        jsr     ra, (t12)               /* call the signal handler (t12==pv) */
        ldq     a0, 0(sp)               /* get the sigcontext pointer */
        lda     sp, 16(sp)
-       CALLSYS_NOERROR(sigreturn)      /* and call sigreturn() with it. */
+       ldiq    v0, SYS_sigreturn       /* and call sigreturn() with it. */
+       call_pal PAL_OSF1_callsys
        .globl  sigcoderet
 sigcoderet:
        mov     v0, a0                  /* if that failed, get error code */
-       CALLSYS_NOERROR(exit)           /* and call exit() with it. */
+       ldiq    v0, SYS_exit            /* and call exit() with it. */
+       call_pal PAL_OSF1_callsys
 XNESTED(esigcode,0)
        END(sigcode)
 
index baf9cac..7838a4d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: asm.h,v 1.15 2022/08/30 16:26:29 miod Exp $ */
+/* $OpenBSD: asm.h,v 1.16 2023/12/06 06:15:33 miod Exp $ */
 /* $NetBSD: asm.h,v 1.23 2000/06/23 12:18:45 kleink Exp $ */
 
 /* 
@@ -590,23 +590,6 @@ label:     ASCIZ msg;                                              \
 /* Pull in PAL "function" codes. */
 #include <machine/pal.h>
 
-/*
- * System call glue.
- */
-#define        SYSCALLNUM(name)                                        \
-       ___CONCAT(SYS_,name)
-
-#define        CALLSYS_NOERROR(name)                                   \
-       ldiq    v0, SYSCALLNUM(name);                           \
-       call_pal PAL_OSF1_callsys
-
-#define NETBSD_SYSCALLNUM(name)                                        \
-       ___CONCAT(NETBSD_SYS_,name)
-
-#define NETBSD_CALLSYS_NOERROR(name)                           \
-       ldiq    v0, NETBSD_SYSCALLNUM(name);                    \
-       call_pal PAL_OSF1_callsys
-
 /*
  * Load the global pointer.
  */