git: 300bbb3a43e3 - main - riscv/SYS.h: implement _SYSCALL_BODY() macro

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

URL: https://cgit.FreeBSD.org/src/commit/?id=300bbb3a43e3cc1337b827b72ff5a22c4321a317

commit 300bbb3a43e3cc1337b827b72ff5a22c4321a317
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

    riscv/SYS.h: implement _SYSCALL_BODY() macro
    
    Add _SYSCALL_BODY() macro which invokes the syscall via _SYCALL() and
    calls cerror as required.  Use to implement PSEUDO() and RSYSCALL().
    
    Reviewed by:    imp, markj
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D43057
---
 lib/libc/riscv/SYS.h | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/libc/riscv/SYS.h b/lib/libc/riscv/SYS.h
index 1e3e67834494..47c79e38f916 100644
--- a/lib/libc/riscv/SYS.h
+++ b/lib/libc/riscv/SYS.h
@@ -40,23 +40,22 @@
 	li	t0, SYS_ ## name;				\
 	ecall
 
-#define	PSEUDO(name)						\
-ENTRY(__sys_##name);						\
-	WEAK_REFERENCE(__sys_##name, _##name);			\
+#define	_SYSCALL_BODY(name)					\
 	_SYSCALL(name);						\
 	bnez	t0, 1f; 					\
 	ret;							\
 1:	la	t1, cerror;					\
-	jr	t1;						\
+	jr	t1
+
+#define	PSEUDO(name)						\
+ENTRY(__sys_##name);						\
+	WEAK_REFERENCE(__sys_##name, _##name);			\
+	_SYSCALL_BODY(name);					\
 END(__sys_##name)
 
 #define	RSYSCALL(name)						\
 ENTRY(__sys_##name);						\
 	WEAK_REFERENCE(__sys_##name, name);			\
 	WEAK_REFERENCE(__sys_##name, _##name);			\
-	_SYSCALL(name);						\
-	bnez	t0, 1f; 					\
-	ret;							\
-1:	la	t1, cerror;					\
-	jr	t1;						\
+	_SYSCALL_BODY(name);					\
 END(__sys_##name)