git: af942daf31f4 - main - LinuxKPI: Add in_compat_syscall()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Nov 2026 18:10:24 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=af942daf31f4eb3bfd8b2765e74ada95a09f149f
commit af942daf31f4eb3bfd8b2765e74ada95a09f149f
Author: Sourojeet Adhikari <siri@racha.ca>
AuthorDate: 2026-11-25 18:09:28 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-11-25 18:09:44 +0000
LinuxKPI: Add in_compat_syscall()
Return true when the current process is a 32-bit process running on a
64-bit kernel, matching the Linux semantics. On native 32-bit kernels
there is no compat ABI, so always return false.
Reviewed by: wulf
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61900
---
sys/compat/linuxkpi/common/include/linux/compat.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h
index 8a5a6918bb7c..5044b4aa03e5 100644
--- a/sys/compat/linuxkpi/common/include/linux/compat.h
+++ b/sys/compat/linuxkpi/common/include/linux/compat.h
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/malloc.h>
+#include <sys/sysent.h>
struct domainset;
struct thread;
@@ -65,4 +66,18 @@ linux_set_current_flags(struct thread *td, int flags)
typedef void fpu_safe_exec_cb_t(void *ctx);
void lkpi_fpu_safe_exec(fpu_safe_exec_cb_t func, void *ctx);
+/*
+ * Linux only treats a system call as a compat one when a 32-bit process
+ * runs on a 64-bit kernel, so native 32-bit kernels always return false.
+ */
+static inline bool
+in_compat_syscall(void)
+{
+#ifdef __LP64__
+ return (SV_CURPROC_FLAG(SV_ILP32) != 0);
+#else
+ return (false);
+#endif
+}
+
#endif /* _LINUXKPI_LINUX_COMPAT_H_ */