git: f21777224411 - main - SYS.h: make _SYSCALL_BODY overridable

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 05 Feb 2024 20:38:47 UTC
The branch main has been updated by brooks:

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

commit f21777224411fee14b8aea6d8465bd6c2b318429
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-01-05 18:33:37 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-02-05 20:34:56 +0000

    SYS.h: make _SYSCALL_BODY overridable
    
    Reviewed by:    kib, emaste, imp
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/908
---
 lib/libsys/aarch64/SYS.h   | 2 ++
 lib/libsys/amd64/SYS.h     | 2 ++
 lib/libsys/arm/SYS.h       | 2 ++
 lib/libsys/i386/SYS.h      | 2 ++
 lib/libsys/powerpc/SYS.h   | 2 ++
 lib/libsys/powerpc64/SYS.h | 2 ++
 lib/libsys/riscv/SYS.h     | 2 ++
 7 files changed, 14 insertions(+)

diff --git a/lib/libsys/aarch64/SYS.h b/lib/libsys/aarch64/SYS.h
index 07d14ab1bb44..a2ff7af18b18 100644
--- a/lib/libsys/aarch64/SYS.h
+++ b/lib/libsys/aarch64/SYS.h
@@ -34,6 +34,7 @@
 	mov	x8, SYS_ ## name;				\
 	svc	0
 
+#ifndef _SYSCALL_BODY
 /*
  * Conditional jumps can only go up to one megabyte in either
  * direction, and cerror can be located anywhere, so we have
@@ -45,6 +46,7 @@
 	b.cs	1f;						\
 	ret;							\
 1:	b	cerror
+#endif
 
 #define	PSEUDO(name)						\
 ENTRY(__sys_##name);						\
diff --git a/lib/libsys/amd64/SYS.h b/lib/libsys/amd64/SYS.h
index 2dfca1896fcd..e27bb2cf9a93 100644
--- a/lib/libsys/amd64/SYS.h
+++ b/lib/libsys/amd64/SYS.h
@@ -40,10 +40,12 @@
 			movq %rcx, %r10;				\
 			syscall
 
+#ifndef _SYSCALL_BODY
 #define	_SYSCALL_BODY(name)						\
 			_SYSCALL(name);					\
 			jb HIDENAME(cerror);				\
 			ret
+#endif
 
 #define	RSYSCALL(name)	ENTRY(__sys_##name);				\
 			WEAK_REFERENCE(__sys_##name, name);		\
diff --git a/lib/libsys/arm/SYS.h b/lib/libsys/arm/SYS.h
index c3bc78704a16..187851c67543 100644
--- a/lib/libsys/arm/SYS.h
+++ b/lib/libsys/arm/SYS.h
@@ -45,11 +45,13 @@
 
 #define	CERROR		_C_LABEL(cerror)
 
+#ifndef _SYSCALL_BODY
 #define _SYSCALL_BODY(x)						\
 	_SYSCALL(x);							\
 	it	cs;							\
 	bcs PIC_SYM(CERROR, PLT);					\
 	RET
+#endif
 
 #define PSEUDO(x)							\
 	ENTRY(__CONCAT(__sys_, x));					\
diff --git a/lib/libsys/i386/SYS.h b/lib/libsys/i386/SYS.h
index 292b705f80f2..f5e0565452da 100644
--- a/lib/libsys/i386/SYS.h
+++ b/lib/libsys/i386/SYS.h
@@ -39,10 +39,12 @@
 			mov $SYS_##name, %eax;				\
 			int $0x80
 
+#ifndef _SYSCALL_BODY
 #define _SYSCALL_BODY(name)						\
 			_SYSCALL(name);					\
 			jb HIDENAME(cerror);				\
 			ret
+#endif
 
 #define	RSYSCALL(name)	ENTRY(__sys_##name);				\
 			WEAK_REFERENCE(__sys_##name, name);		\
diff --git a/lib/libsys/powerpc/SYS.h b/lib/libsys/powerpc/SYS.h
index b990793c7e3e..04672ed51528 100644
--- a/lib/libsys/powerpc/SYS.h
+++ b/lib/libsys/powerpc/SYS.h
@@ -40,10 +40,12 @@
 	li	0,(SYS_##name);					\
 	sc
 
+#ifndef _SYSCALL_BODY
 #define	_SYSCALL_BODY(name)					\
 	_SYSCALL(name);						\
 	bnslr;							\
 	b	CNAME(HIDENAME(cerror))
+#endif
 
 #define	PSEUDO(name)						\
 	.text;							\
diff --git a/lib/libsys/powerpc64/SYS.h b/lib/libsys/powerpc64/SYS.h
index bf8bc6cc0e27..ceb85bb4e361 100644
--- a/lib/libsys/powerpc64/SYS.h
+++ b/lib/libsys/powerpc64/SYS.h
@@ -40,6 +40,7 @@
 	li	0,(SYS_##name);					\
 	sc
 
+#ifndef _SYSCALL_BODY
 #define _SYSCALL_BODY(name)					\
 	_SYSCALL(name);						\
 	bnslr;							\
@@ -52,6 +53,7 @@
 	ld	%r0,16(%r1);					\
 	mtlr	%r0;						\
 	blr
+#endif
 
 #define	PSEUDO(name)						\
 	.text;							\
diff --git a/lib/libsys/riscv/SYS.h b/lib/libsys/riscv/SYS.h
index 47c79e38f916..c2d93c567e2b 100644
--- a/lib/libsys/riscv/SYS.h
+++ b/lib/libsys/riscv/SYS.h
@@ -40,12 +40,14 @@
 	li	t0, SYS_ ## name;				\
 	ecall
 
+#ifndef _SYSCALL_BODY
 #define	_SYSCALL_BODY(name)					\
 	_SYSCALL(name);						\
 	bnez	t0, 1f; 					\
 	ret;							\
 1:	la	t1, cerror;					\
 	jr	t1
+#endif
 
 #define	PSEUDO(name)						\
 ENTRY(__sys_##name);						\