summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorryo <ryo@NetBSD.org>2021-11-25 03:08:03 +0000
committerryo <ryo@NetBSD.org>2021-11-25 03:08:03 +0000
commit172281034fb9508dbffcabf787097cd4cb73031d (patch)
tree0cdb2b955215a20d79c8727e09f5080615856883 /sys/compat/linux
parent527e592f4c1b061d03489e0d4bd5015b14ade55a (diff)
add support COMPAT_LINUX32 for aarch64
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/arch/aarch64/linux_commons.c5
-rw-r--r--sys/compat/linux/arch/aarch64/linux_machdep.h45
-rw-r--r--sys/compat/linux/common/linux_file.c10
-rw-r--r--sys/compat/linux/common/linux_misc.c6
-rw-r--r--sys/compat/linux/common/linux_misc_notalpha.c6
-rw-r--r--sys/compat/linux/common/linux_oldmmap.c8
-rw-r--r--sys/compat/linux/common/linux_sig_notalpha.c9
7 files changed, 62 insertions, 27 deletions
diff --git a/sys/compat/linux/arch/aarch64/linux_commons.c b/sys/compat/linux/arch/aarch64/linux_commons.c
index 9fb78d98d76..10793b4cf82 100644
--- a/sys/compat/linux/arch/aarch64/linux_commons.c
+++ b/sys/compat/linux/arch/aarch64/linux_commons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_commons.c,v 1.2 2021/10/12 08:36:28 andvar Exp $ */
+/* $NetBSD: linux_commons.c,v 1.3 2021/11/25 03:08:04 ryo Exp $ */
/*
* This file includes C files from the common
@@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_commons.c,v 1.2 2021/10/12 08:36:28 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_commons.c,v 1.3 2021/11/25 03:08:04 ryo Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -34,4 +34,5 @@ __KERNEL_RCSID(0, "$NetBSD: linux_commons.c,v 1.2 2021/10/12 08:36:28 andvar Exp
#include "../../common/linux_pipe.c"
#include "../../common/linux_file64.c"
#include "../../common/linux_misc_notalpha.c"
+#include "../../common/linux_sig_notalpha.c"
#include "../../common/linux_fadvise64.c"
diff --git a/sys/compat/linux/arch/aarch64/linux_machdep.h b/sys/compat/linux/arch/aarch64/linux_machdep.h
index 931ea1cf751..71421abdaf0 100644
--- a/sys/compat/linux/arch/aarch64/linux_machdep.h
+++ b/sys/compat/linux/arch/aarch64/linux_machdep.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.h,v 1.1 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_machdep.h,v 1.2 2021/11/25 03:08:04 ryo Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -74,6 +74,49 @@ struct linux_rt_sigframe {
struct linux_ucontext uc;
};
+/*
+ * Not required for COMPAT_LINUX,
+ * but required for COMPAT_LINUX32.
+ */
+struct linux_sys_open_args {
+ syscallarg(const char *) path;
+ syscallarg(int) flags;
+ syscallarg(linux_umode_t) mode;
+};
+int linux_sys_open(struct lwp *, const struct linux_sys_open_args *, register_t *);
+
+struct linux_sys_eventfd_args {
+ syscallarg(unsigned int) initval;
+};
+int linux_sys_eventfd(struct lwp *, const struct linux_sys_eventfd_args *, register_t *);
+
+struct linux_sys_llseek_args {
+ syscallarg(int) fd;
+ syscallarg(u_int32_t) ohigh;
+ syscallarg(u_int32_t) olow;
+ syscallarg(void *) res;
+ syscallarg(int) whence;
+};
+int linux_sys_llseek(struct lwp *, const struct linux_sys_llseek_args *, register_t *);
+
+struct linux_sys_unlink_args {
+ syscallarg(const char *) path;
+};
+int linux_sys_unlink(struct lwp *, const struct linux_sys_unlink_args *, register_t *);
+
+struct linux_sys_mknod_args {
+ syscallarg(const char *) path;
+ syscallarg(linux_umode_t) mode;
+ syscallarg(unsigned) dev;
+};
+int linux_sys_mknod(struct lwp *, const struct linux_sys_mknod_args *, register_t *);
+
+struct linux_sys_alarm_args {
+ syscallarg(unsigned int) secs;
+};
+int linux_sys_alarm(struct lwp *, const struct linux_sys_alarm_args *, register_t *);
+
+int linux_sys_pause(struct lwp *, const void *, register_t *);
#ifdef _KERNEL
__BEGIN_DECLS
diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c
index 06e40091019..64f806cc74b 100644
--- a/sys/compat/linux/common/linux_file.c
+++ b/sys/compat/linux/common/linux_file.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file.c,v 1.121 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_file.c,v 1.122 2021/11/25 03:08:04 ryo Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.121 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.122 2021/11/25 03:08:04 ryo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -206,7 +206,6 @@ linux_open_ctty(struct lwp *l, int flags, int fd)
}
}
-#if !defined(__aarch64__)
/*
* open(2). Take care of the different flag values, and let the
* NetBSD syscall do the real work. See if this operation
@@ -236,7 +235,6 @@ linux_sys_open(struct lwp *l, const struct linux_sys_open_args *uap, register_t
linux_open_ctty(l, fl, *retval);
return 0;
}
-#endif
int
linux_sys_openat(struct lwp *l, const struct linux_sys_openat_args *uap, register_t *retval)
@@ -612,7 +610,6 @@ linux_unlink_dircheck(const char *path)
return error ? error : EPERM;
}
-#if !defined(__aarch64__)
int
linux_sys_unlink(struct lwp *l, const struct linux_sys_unlink_args *uap, register_t *retval)
{
@@ -627,7 +624,6 @@ linux_sys_unlink(struct lwp *l, const struct linux_sys_unlink_args *uap, registe
return error;
}
-#endif
int
linux_sys_unlinkat(struct lwp *l, const struct linux_sys_unlinkat_args *uap, register_t *retval)
@@ -651,7 +647,6 @@ linux_sys_unlinkat(struct lwp *l, const struct linux_sys_unlinkat_args *uap, reg
return error;
}
-#if !defined(__aarch64__)
int
linux_sys_mknod(struct lwp *l, const struct linux_sys_mknod_args *uap, register_t *retval)
{
@@ -669,7 +664,6 @@ linux_sys_mknod(struct lwp *l, const struct linux_sys_mknod_args *uap, register_
return linux_sys_mknodat(l, &ua, retval);
}
-#endif
int
linux_sys_mknodat(struct lwp *l, const struct linux_sys_mknodat_args *uap, register_t *retval)
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index e3b463589da..c459dd35f42 100644
--- a/sys/compat/linux/common/linux_misc.c
+++ b/sys/compat/linux/common/linux_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.254 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_misc.c,v 1.255 2021/11/25 03:08:04 ryo Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.254 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.255 2021/11/25 03:08:04 ryo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1616,7 +1616,6 @@ linux_do_eventfd2(struct lwp *l, unsigned int initval, int flags,
return do_eventfd(l, initval, nflags, retval);
}
-#if !defined(__aarch64__)
int
linux_sys_eventfd(struct lwp *l, const struct linux_sys_eventfd_args *uap,
register_t *retval)
@@ -1627,7 +1626,6 @@ linux_sys_eventfd(struct lwp *l, const struct linux_sys_eventfd_args *uap,
return linux_do_eventfd2(l, SCARG(uap, initval), 0, retval);
}
-#endif
int
linux_sys_eventfd2(struct lwp *l, const struct linux_sys_eventfd2_args *uap,
diff --git a/sys/compat/linux/common/linux_misc_notalpha.c b/sys/compat/linux/common/linux_misc_notalpha.c
index 7971df75b56..263cdc5ca38 100644
--- a/sys/compat/linux/common/linux_misc_notalpha.c
+++ b/sys/compat/linux/common/linux_misc_notalpha.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc_notalpha.c,v 1.113 2021/09/23 11:28:47 christos Exp $ */
+/* $NetBSD: linux_misc_notalpha.c,v 1.114 2021/11/25 03:08:04 ryo Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.113 2021/09/23 11:28:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.114 2021/11/25 03:08:04 ryo Exp $");
/*
* Note that we must NOT include "opt_compat_linux32.h" here,
@@ -85,7 +85,6 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.113 2021/09/23 11:28:47 ch
#endif
#ifndef COMPAT_LINUX32
-#if !defined(__aarch64__)
/*
* Alarm. This is a libc call which uses setitimer(2) in NetBSD.
* Do the same here.
@@ -121,7 +120,6 @@ linux_sys_alarm(struct lwp *l, const struct linux_sys_alarm_args *uap, register_
*retval = oitv.it_value.tv_sec;
return 0;
}
-#endif
#endif /* !COMPAT_LINUX32 */
#if !defined(__aarch64__) && !defined(__amd64__)
diff --git a/sys/compat/linux/common/linux_oldmmap.c b/sys/compat/linux/common/linux_oldmmap.c
index a7808b1099b..5c5ab09e924 100644
--- a/sys/compat/linux/common/linux_oldmmap.c
+++ b/sys/compat/linux/common/linux_oldmmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_oldmmap.c,v 1.73 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_oldmmap.c,v 1.74 2021/11/25 03:08:04 ryo Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.73 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.74 2021/11/25 03:08:04 ryo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,8 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.73 2021/09/23 06:56:27 ryo Exp $
#include <compat/linux/linux_syscallargs.h>
/* Used on: arm, i386, m68k */
-/* Used for linux32 on: amd64 */
-/* Not used on: aarch64, alpha, mips, pcc, sparc, sparc64 */
+/* Used for linux32 on: aarch64, amd64 */
+/* Not used on: alpha, mips, pcc, sparc, sparc64 */
#undef DPRINTF
#ifdef DEBUG_LINUX
diff --git a/sys/compat/linux/common/linux_sig_notalpha.c b/sys/compat/linux/common/linux_sig_notalpha.c
index ccad2f6baa2..daf68648747 100644
--- a/sys/compat/linux/common/linux_sig_notalpha.c
+++ b/sys/compat/linux/common/linux_sig_notalpha.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sig_notalpha.c,v 1.40 2021/09/23 06:56:27 ryo Exp $ */
+/* $NetBSD: linux_sig_notalpha.c,v 1.41 2021/11/25 03:08:04 ryo Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.40 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.41 2021/11/25 03:08:04 ryo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,9 +56,10 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.40 2021/09/23 06:56:27 ryo
#include <compat/linux/linux_syscallargs.h>
/* Used on: arm, i386, m68k, mips, sparc, sparc64 */
-/* Not used on: aarch64, alpha */
+/* Partly used on: aarch64, amd64 */
+/* Not used on: alpha */
-#if !defined(__amd64__)
+#if !defined(__aarch64__) && !defined(__amd64__)
/*
* The Linux signal() system call. I think that the signal() in the C
* library actually calls sigaction, so I doubt this one is ever used.