From 6750a6d9ed379192e2f26860ea46d0fa79c53de8 Mon Sep 17 00:00:00 2001 From: miod Date: Wed, 6 Dec 2023 06:15:33 +0000 Subject: [PATCH] Move CALLSYS_NOERROR macro from to libc, and expand it for 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 | 5 ++++- libexec/ld.so/alpha/SYS.h | 5 +++-- sys/arch/alpha/alpha/locore.s | 8 +++++--- sys/arch/alpha/include/asm.h | 19 +------------------ 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/lib/libc/arch/alpha/SYS.h b/lib/libc/arch/alpha/SYS.h index a7f505b7589..688864beff0 100644 --- a/lib/libc/arch/alpha/SYS.h +++ b/lib/libc/arch/alpha/SYS.h @@ -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); \ diff --git a/libexec/ld.so/alpha/SYS.h b/libexec/ld.so/alpha/SYS.h index 004fe5f9c73..4472afa8a11 100644 --- a/libexec/ld.so/alpha/SYS.h +++ b/libexec/ld.so/alpha/SYS.h @@ -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: \ diff --git a/sys/arch/alpha/alpha/locore.s b/sys/arch/alpha/alpha/locore.s index 959a6d0326c..1bbf06a512a 100644 --- a/sys/arch/alpha/alpha/locore.s +++ b/sys/arch/alpha/alpha/locore.s @@ -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) diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h index baf9cacce12..7838a4ddd17 100644 --- a/sys/arch/alpha/include/asm.h +++ b/sys/arch/alpha/include/asm.h @@ -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 -/* - * 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. */ -- 2.20.1