git: 8a1b84f861e8 - main - arm/SYS.h: align with other arches

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 18 Dec 2023 22:29:01 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a1b84f861e869a76b1902692dbb93c2a54081d5

commit 8a1b84f861e869a76b1902692dbb93c2a54081d5
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-12-18 22:28:42 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-12-18 22:28:42 +0000

    arm/SYS.h: align with other arches
    
    Rename SYSTRAP() macro to _SYSCALL() and add _SYSCALL_BODY() which invokes
    the syscall via _SYCALL() and then calls cerror as required.  Use to
    implement PSEUDO() and RSYSCALL() removing _SYSCALL_NOERROR().
    
    Reviewed by:    imp
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D43061
---
 lib/libc/arm/SYS.h       | 30 ++++++++++++------------------
 lib/libc/arm/sys/vfork.S |  2 +-
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/lib/libc/arm/SYS.h b/lib/libc/arm/SYS.h
index a1150ed03dc6..c3bc78704a16 100644
--- a/lib/libc/arm/SYS.h
+++ b/lib/libc/arm/SYS.h
@@ -37,7 +37,7 @@
 #include <machine/asm.h>
 #include <sys/syscall.h>
 
-#define SYSTRAP(x)							\
+#define _SYSCALL(x)							\
 			mov ip, r7;					\
 			ldr r7, =SYS_ ## x;				\
 			swi 0;						\
@@ -45,30 +45,24 @@
 
 #define	CERROR		_C_LABEL(cerror)
 
-#define _SYSCALL_NOERROR(x)						\
-	ENTRY(__CONCAT(__sys_, x));					\
-	.weak _C_LABEL(x);						\
-	.set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x));			\
-	.weak _C_LABEL(__CONCAT(_,x));					\
-	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
-	SYSTRAP(x)
-
-#define _SYSCALL(x)							\
-	_SYSCALL_NOERROR(x);						\
+#define _SYSCALL_BODY(x)						\
+	_SYSCALL(x);							\
 	it	cs;							\
-	bcs PIC_SYM(CERROR, PLT)
+	bcs PIC_SYM(CERROR, PLT);					\
+	RET
 
 #define PSEUDO(x)							\
 	ENTRY(__CONCAT(__sys_, x));					\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
-	SYSTRAP(x);							\
-	it	cs;							\
-	bcs PIC_SYM(CERROR, PLT);					\
-	RET
+	_SYSCALL_BODY(x)
 
 #define RSYSCALL(x)							\
-	_SYSCALL(x);							\
-	RET
+	ENTRY(__CONCAT(__sys_, x));					\
+	.weak _C_LABEL(x);						\
+	.set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x));			\
+	.weak _C_LABEL(__CONCAT(_,x));					\
+	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
+	_SYSCALL_BODY(x);						\
 
 	.globl  CERROR
diff --git a/lib/libc/arm/sys/vfork.S b/lib/libc/arm/sys/vfork.S
index 5cc8afc8d953..2b92f56ad4e4 100644
--- a/lib/libc/arm/sys/vfork.S
+++ b/lib/libc/arm/sys/vfork.S
@@ -44,7 +44,7 @@
 
 ENTRY(vfork)
 	mov	r2, r14
-	SYSTRAP(vfork)
+	_SYSCALL(vfork)
 	bcs	PIC_SYM(CERROR, PLT)
 	sub	r1, r1, #1	/* r1 == 0xffffffff if parent, 0 if child */
 	and	r0, r0, r1	/* r0 == 0 if child, else unchanged */