git: 13f345cdecd3 - main - powerpc64/SYS.h: implement _SYSCALL_BODY() macro

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Tue, 09 Jan 2024 23:00:23 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=13f345cdecd3e208b9226e3b1dcc39737ab2881b

commit 13f345cdecd3e208b9226e3b1dcc39737ab2881b
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-01-09 19:37:42 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-01-09 22:59:29 +0000

    powerpc64/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:    jhibbits
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D43322
---
 lib/libc/powerpc64/SYS.h | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/lib/libc/powerpc64/SYS.h b/lib/libc/powerpc64/SYS.h
index dccd08b63541..bf8bc6cc0e27 100644
--- a/lib/libc/powerpc64/SYS.h
+++ b/lib/libc/powerpc64/SYS.h
@@ -40,11 +40,7 @@
 	li	0,(SYS_##name);					\
 	sc
 
-#define	PSEUDO(name)						\
-	.text;							\
-	.align 2;						\
-ENTRY(__sys_##name);						\
-	WEAK_REFERENCE(__sys_##name, _##name);			\
+#define _SYSCALL_BODY(name)					\
 	_SYSCALL(name);						\
 	bnslr;							\
 	mflr	%r0;						\
@@ -55,7 +51,14 @@ ENTRY(__sys_##name);						\
 	addi	%r1,%r1,48;					\
 	ld	%r0,16(%r1);					\
 	mtlr	%r0;						\
-	blr;							\
+	blr
+
+#define	PSEUDO(name)						\
+	.text;							\
+	.align 2;						\
+ENTRY(__sys_##name);						\
+	WEAK_REFERENCE(__sys_##name, _##name);			\
+	_SYSCALL_BODY(name);					\
 END(__sys_##name)
 
 #define	RSYSCALL(name)						\
@@ -64,16 +67,5 @@ END(__sys_##name)
 ENTRY(__sys_##name);						\
 	WEAK_REFERENCE(__sys_##name, name);			\
 	WEAK_REFERENCE(__sys_##name, _##name);			\
-	_SYSCALL(name);						\
-	bnslr;							\
-								\
-	mflr	%r0;						\
-	std	%r0,16(%r1);					\
-	stdu	%r1,-48(%r1);					\
-	bl	CNAME(HIDENAME(cerror));			\
-	nop;							\
-	addi	%r1,%r1,48;					\
-	ld	%r0,16(%r1);					\
-	mtlr	%r0;						\
-	blr;							\
+	_SYSCALL_BODY(name);					\
 END(__sys_##name)