summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common
diff options
context:
space:
mode:
authormanu <manu@NetBSD.org>2005-05-03 16:26:27 +0000
committermanu <manu@NetBSD.org>2005-05-03 16:26:27 +0000
commit89647c7ca6f19d5682117c3285ebb8c8ba833a59 (patch)
tree2cc8787cfddb0914a698128c37c6b96bea19899a /sys/compat/linux/common
parent6c6d96d112084303316c8cb293d4b2e4b1987097 (diff)
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to Linux arch_prctl(2) not being really supported yet.
Diffstat (limited to 'sys/compat/linux/common')
-rw-r--r--sys/compat/linux/common/linux_errno.h4
-rw-r--r--sys/compat/linux/common/linux_exec.h5
-rw-r--r--sys/compat/linux/common/linux_exec_elf32.c7
-rw-r--r--sys/compat/linux/common/linux_fcntl.h4
-rw-r--r--sys/compat/linux/common/linux_file.c21
-rw-r--r--sys/compat/linux/common/linux_file64.c8
-rw-r--r--sys/compat/linux/common/linux_ioctl.h4
-rw-r--r--sys/compat/linux/common/linux_ipccall.h6
-rw-r--r--sys/compat/linux/common/linux_machdep.h4
-rw-r--r--sys/compat/linux/common/linux_misc.c17
-rw-r--r--sys/compat/linux/common/linux_misc.h6
-rw-r--r--sys/compat/linux/common/linux_misc_notalpha.c16
-rw-r--r--sys/compat/linux/common/linux_mmap.h4
-rw-r--r--sys/compat/linux/common/linux_prctl.h44
-rw-r--r--sys/compat/linux/common/linux_sig_notalpha.c8
-rw-r--r--sys/compat/linux/common/linux_sigaction.c8
-rw-r--r--sys/compat/linux/common/linux_siginfo.h4
-rw-r--r--sys/compat/linux/common/linux_signal.c13
-rw-r--r--sys/compat/linux/common/linux_signal.h9
-rw-r--r--sys/compat/linux/common/linux_socket.c6
-rw-r--r--sys/compat/linux/common/linux_socket.h4
-rw-r--r--sys/compat/linux/common/linux_socketcall.c6
-rw-r--r--sys/compat/linux/common/linux_socketcall.h4
-rw-r--r--sys/compat/linux/common/linux_termios.h4
-rw-r--r--sys/compat/linux/common/linux_time.c7
-rw-r--r--sys/compat/linux/common/linux_types.h4
26 files changed, 166 insertions, 61 deletions
diff --git a/sys/compat/linux/common/linux_errno.h b/sys/compat/linux/common/linux_errno.h
index fe063e1a5ac..056dedfce85 100644
--- a/sys/compat/linux/common/linux_errno.h
+++ b/sys/compat/linux/common/linux_errno.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_errno.h,v 1.10 2004/06/19 22:59:40 manu Exp $ */
+/* $NetBSD: linux_errno.h,v 1.11 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -90,6 +90,8 @@
#include <compat/linux/arch/m68k/linux_errno.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_errno.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_errno.h>
#else
#include <compat/linux/arch/i386/linux_errno.h> /* XXX:Allow kdump to compile */
#endif
diff --git a/sys/compat/linux/common/linux_exec.h b/sys/compat/linux/common/linux_exec.h
index 2e4a42ff7ab..6496b57c94a 100644
--- a/sys/compat/linux/common/linux_exec.h
+++ b/sys/compat/linux/common/linux_exec.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_exec.h,v 1.33 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_exec.h,v 1.34 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -51,6 +51,8 @@
#include <compat/linux/arch/mips/linux_exec.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_exec.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_exec.h>
#endif
@@ -92,6 +94,7 @@
#define LINUX_AT_PLATFORM 15 /* CPU string for optimizations */
#define LINUX_AT_HWCAP 16 /* arch dependent CPU capabilities */
#define LINUX_AT_CLKTCK 17 /* frequency times() increments */
+#define LINUX_AT_SECURE 23 /* secure mode boolean */
/*
* Emulation specific sysctls.
diff --git a/sys/compat/linux/common/linux_exec_elf32.c b/sys/compat/linux/common/linux_exec_elf32.c
index cac0a26ad6e..c1666ca9518 100644
--- a/sys/compat/linux/common/linux_exec_elf32.c
+++ b/sys/compat/linux/common/linux_exec_elf32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_exec_elf32.c,v 1.67 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_exec_elf32.c,v 1.68 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.67 2005/02/26 23:10:19 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.68 2005/05/03 16:26:28 manu Exp $");
#ifndef ELFSIZE
/* XXX should die */
@@ -296,6 +296,9 @@ ELFNAME2(linux,signature)(p, epp, eh, itp)
/* Check for certain intepreter names. */
if (itp) {
if (!strncmp(itp, "/lib/ld-linux", 13) ||
+#if (ELFSIZE == 64)
+ !strncmp(itp, "/lib64/ld-linux", 15) ||
+#endif
!strncmp(itp, "/lib/ld.so.", 11))
error = 0;
else
diff --git a/sys/compat/linux/common/linux_fcntl.h b/sys/compat/linux/common/linux_fcntl.h
index b4fbe9a7e79..3ad7f3bf509 100644
--- a/sys/compat/linux/common/linux_fcntl.h
+++ b/sys/compat/linux/common/linux_fcntl.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_fcntl.h,v 1.9 2002/03/22 14:54:49 christos Exp $ */
+/* $NetBSD: linux_fcntl.h,v 1.10 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -77,6 +77,8 @@ struct linux_flock64 {
#include <compat/linux/arch/mips/linux_fcntl.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_fcntl.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_fcntl.h>
#else
#error Undefined linux_fcntl.h machine type.
#endif
diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c
index 5807e8ac7b8..a3475771c8a 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.66 2005/03/10 14:12:28 christos Exp $ */
+/* $NetBSD: linux_file.c,v 1.67 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.66 2005/03/10 14:12:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.67 2005/05/03 16:26:28 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,8 +76,10 @@ static int linux_to_bsd_ioflags __P((int));
static int bsd_to_linux_ioflags __P((int));
static void bsd_to_linux_flock __P((struct flock *, struct linux_flock *));
static void linux_to_bsd_flock __P((struct linux_flock *, struct flock *));
+#ifndef __amd64__
static void bsd_to_linux_stat __P((struct stat *, struct linux_stat *));
static int linux_stat1 __P((struct lwp *, void *, register_t *, int));
+#endif
/*
* Some file-related calls are handled here. The usual flag conversion
@@ -485,6 +487,7 @@ linux_sys_fcntl(l, v, retval)
return sys_fcntl(l, &fca, retval);
}
+#if !defined(__amd64__)
/*
* Convert a NetBSD stat structure to a Linux stat structure.
* Only the order of the fields and the padding in the structure
@@ -633,6 +636,7 @@ linux_sys_lstat(l, v, retval)
return linux_stat1(l, uap, retval, 1);
}
+#endif /* !__amd64__ */
/*
* The following syscalls are mostly here because of the alternate path check.
@@ -773,7 +777,8 @@ linux_sys_chmod(l, v, retval)
return sys_chmod(l, uap, retval);
}
-#if defined(__i386__) || defined(__m68k__) || defined(__arm__)
+#if defined(__i386__) || defined(__m68k__) || \
+ defined(__arm__)
int
linux_sys_chown16(l, v, retval)
struct lwp *l;
@@ -847,9 +852,9 @@ linux_sys_lchown16(l, v, retval)
return sys___posix_lchown(l, &bla, retval);
}
-#endif /* __i386__ || __m68k__ || __arm__ */
-#if defined (__i386__) || defined (__m68k__) || \
- defined (__powerpc__) || defined (__mips__) || defined(__arm__)
+#endif /* __i386__ || __m68k__ || __arm__ || __amd64__ */
+#if defined (__i386__) || defined (__m68k__) || defined(__amd64__) || \
+ defined (__powerpc__) || defined (__mips__) || defined (__arm__)
int
linux_sys_chown(l, v, retval)
struct lwp *l;
@@ -887,7 +892,7 @@ linux_sys_lchown(l, v, retval)
return sys___posix_lchown(l, uap, retval);
}
-#endif /* __i386__ || __m68k__ || __powerpc__ || __mips__ || __arm__ */
+#endif /* __i386__||__m68k__||__powerpc__||__mips__||__arm__ ||__amd64__ */
int
linux_sys_rename(l, v, retval)
@@ -1000,6 +1005,7 @@ linux_sys_readlink(l, v, retval)
return sys_readlink(l, uap, retval);
}
+#if !defined(__amd64__)
int
linux_sys_truncate(l, v, retval)
struct lwp *l;
@@ -1017,6 +1023,7 @@ linux_sys_truncate(l, v, retval)
return compat_43_sys_truncate(l, uap, retval);
}
+#endif /* !__amd64__ */
/*
* This is just fsync() for now (just as it is in the Linux kernel)
diff --git a/sys/compat/linux/common/linux_file64.c b/sys/compat/linux/common/linux_file64.c
index f8389e5c2cf..ee2f9db95eb 100644
--- a/sys/compat/linux/common/linux_file64.c
+++ b/sys/compat/linux/common/linux_file64.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file64.c,v 1.26 2005/04/19 19:00:25 christos Exp $ */
+/* $NetBSD: linux_file64.c,v 1.27 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.26 2005/04/19 19:00:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.27 2005/05/03 16:26:28 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -266,7 +266,7 @@ linux_sys_ftruncate64(l, v, retval)
return sys_ftruncate(l, &ta, retval);
}
-#if !defined(__m68k__)
+#if !defined(__m68k__) && !defined(__amd64__)
static void bsd_to_linux_flock64 __P((struct linux_flock64 *,
const struct flock *));
static void linux_to_bsd_flock64 __P((struct flock *,
@@ -375,7 +375,7 @@ linux_sys_fcntl64(l, v, retval)
return linux_sys_fcntl(l, v, retval);
}
}
-#endif /* !m68k */
+#endif /* !m68k && !amd64 */
#endif /* !alpha */
diff --git a/sys/compat/linux/common/linux_ioctl.h b/sys/compat/linux/common/linux_ioctl.h
index f49354e6ff3..6db56cb9ef2 100644
--- a/sys/compat/linux/common/linux_ioctl.h
+++ b/sys/compat/linux/common/linux_ioctl.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ioctl.h,v 1.21 2005/02/28 22:11:32 soren Exp $ */
+/* $NetBSD: linux_ioctl.h,v 1.22 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -75,6 +75,8 @@ __END_DECLS
#include <compat/linux/arch/mips/linux_ioctl.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_ioctl.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_ioctl.h>
#else
#error Undefined linux_ioctl.h machine type.
#endif
diff --git a/sys/compat/linux/common/linux_ipccall.h b/sys/compat/linux/common/linux_ipccall.h
index be2c01929da..7f8325f4a43 100644
--- a/sys/compat/linux/common/linux_ipccall.h
+++ b/sys/compat/linux/common/linux_ipccall.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ipccall.h,v 1.8 2003/01/18 08:02:53 thorpej Exp $ */
+/* $NetBSD: linux_ipccall.h,v 1.9 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -43,9 +43,9 @@
* All linux architectures except alpha use the sys_ipc
* syscall and need the associated defines.
*/
-# if !defined(__alpha__)
+# if !defined(__alpha__) && !defined(__amd64__)
/* Used on: arm, i386, m68k, mips, ppc, sparc, sparc64 */
-/* Not used on: alpha */
+/* Not used on: alpha, amd64 */
/*
* Defines for the numbers passes as the first argument to the
diff --git a/sys/compat/linux/common/linux_machdep.h b/sys/compat/linux/common/linux_machdep.h
index 54ea4758b6a..c611e3e27eb 100644
--- a/sys/compat/linux/common/linux_machdep.h
+++ b/sys/compat/linux/common/linux_machdep.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.h,v 1.11 2004/03/26 15:01:16 drochner Exp $ */
+/* $NetBSD: linux_machdep.h,v 1.12 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -51,6 +51,8 @@
#include <compat/linux/arch/mips/linux_machdep.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_machdep.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_machdep.h>
#else
#error Undefined linux_machdep.h machine type.
#endif
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index 7bd40fa868b..178106160ec 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.136 2005/04/19 19:00:25 christos Exp $ */
+/* $NetBSD: linux_misc.c,v 1.137 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.136 2005/04/19 19:00:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.137 2005/05/03 16:26:28 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -166,8 +166,10 @@ const int linux_fstypes_cnt = sizeof(linux_fstypes) / sizeof(linux_fstypes[0]);
#endif
/* Local linux_misc.c functions: */
+#ifndef __amd64__
static void bsd_to_linux_statfs __P((const struct statvfs *,
struct linux_statfs *));
+#endif
static int linux_to_bsd_limit __P((int));
static void linux_to_bsd_mmap_args __P((struct sys_mmap_args *,
const struct linux_sys_mmap_args *));
@@ -300,6 +302,7 @@ linux_sys_brk(l, v, retval)
return 0;
}
+#ifndef __amd64__
/*
* Convert NetBSD statvfs structure to Linux statfs structure.
* Linux doesn't have f_flag, and we can't set f_frsize due
@@ -425,6 +428,7 @@ linux_sys_fstatfs(l, v, retval)
return copyout((caddr_t) &ltmp, (caddr_t) SCARG(uap, sp), sizeof ltmp);
}
+#endif /* __amd64__ */
/*
* uname(). Just copy the info from the various strings stored in the
@@ -1272,7 +1276,7 @@ out:
return error;
}
-#endif /* __i386__ || __m68k__ */
+#endif /* __i386__ || __m68k__ || __amd64__ */
/*
* We have nonexistent fsuid equal to uid.
@@ -1375,7 +1379,7 @@ linux_sys_ptrace(l, v, retval)
{
struct linux_sys_ptrace_args /* {
i386, m68k, powerpc: T=int
- alpha: T=long
+ alpha, amd64: T=long
syscallarg(T) request;
syscallarg(T) pid;
syscallarg(T) addr;
@@ -1412,7 +1416,8 @@ linux_sys_ptrace(l, v, retval)
case LINUX_PTRACE_PEEKTEXT:
case LINUX_PTRACE_PEEKDATA:
error = copyout (retval,
- (caddr_t)SCARG(uap, data), sizeof *retval);
+ (caddr_t)SCARG(uap, data),
+ sizeof *retval);
*retval = SCARG(uap, data);
break;
default:
@@ -1681,7 +1686,7 @@ linux_sys_setrlimit(l, v, retval)
return sys_setrlimit(l, &ap, retval);
}
-#ifndef __mips__
+#if !defined(__mips__) && !defined(__amd64__)
/* XXX: this doesn't look 100% common, at least mips doesn't have it */
int
linux_sys_ugetrlimit(l, v, retval)
diff --git a/sys/compat/linux/common/linux_misc.h b/sys/compat/linux/common/linux_misc.h
index 63147c27a8c..25e4d88ade6 100644
--- a/sys/compat/linux/common/linux_misc.h
+++ b/sys/compat/linux/common/linux_misc.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.h,v 1.11 2004/11/13 07:19:27 christos Exp $ */
+/* $NetBSD: linux_misc.h,v 1.12 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -83,7 +83,11 @@ struct linux_sysinfo {
#define LINUX_RLIMIT_MEMLOCK 8
#define LINUX_RLIMIT_AS 9
#define LINUX_RLIMIT_LOCKS 10
+#ifdef __mips__ /* XXX only mips32. On mips64, it's ~0ul */
+#define LINUX_RLIM_INFINITY 0x7fffffffUL
+#else
#define LINUX_RLIM_INFINITY ~0ul
+#endif
/* When we don't know what to do, let it believe it is local */
diff --git a/sys/compat/linux/common/linux_misc_notalpha.c b/sys/compat/linux/common/linux_misc_notalpha.c
index fecc223a984..ec72eec11c3 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.73 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_misc_notalpha.c,v 1.74 2005/05/03 16:26:28 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.73 2005/02/26 23:10:19 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.74 2005/05/03 16:26:28 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -81,7 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.73 2005/02/26 23:10:19 per
#define DPRINTF(a)
#endif
-#ifndef __m68k__
+#if !defined(__m68k__)
static void bsd_to_linux_statfs64(const struct statvfs *,
struct linux_statfs64 *);
#endif
@@ -179,6 +179,7 @@ linux_sys_alarm(l, v, retval)
return 0;
}
+#ifndef __amd64__
int
linux_sys_nice(l, v, retval)
struct lwp *l;
@@ -195,7 +196,9 @@ linux_sys_nice(l, v, retval)
SCARG(&bsa, prio) = SCARG(uap, incr);
return sys_setpriority(l, &bsa, retval);
}
+#endif
+#ifndef __amd64__
/*
* The old Linux readdir was only able to read one entry at a time,
* even though it had a 'count' argument. In fact, the emulation
@@ -220,6 +223,7 @@ linux_sys_readdir(l, v, retval)
SCARG(uap, count) = 1;
return linux_sys_getdents(l, uap, retval);
}
+#endif /* !amd64 */
/*
* I wonder why Linux has gettimeofday() _and_ time().. Still, we
@@ -291,6 +295,7 @@ linux_sys_utime(l, v, retval)
return sys_utimes(l, &ua, retval);
}
+#ifndef __amd64__
/*
* waitpid(2). Just forward on to linux_sys_wait4 with a NULL rusage.
*/
@@ -314,6 +319,7 @@ linux_sys_waitpid(l, v, retval)
return linux_sys_wait4(l, &linux_w4a, retval);
}
+#endif /* !amd64 */
int
linux_sys_setresgid(l, v, retval)
@@ -372,6 +378,7 @@ linux_sys_getresgid(l, v, retval)
return (copyout(&pc->p_svgid, SCARG(uap, sgid), sizeof(gid_t)));
}
+#ifndef __amd64__
/*
* I wonder why Linux has settimeofday() _and_ stime().. Still, we
* need to deal with it.
@@ -404,8 +411,9 @@ linux_sys_stime(l, v, retval)
return 0;
}
+#endif /* !amd64 */
-#ifndef __m68k__
+#if !defined(__m68k__)
/*
* Convert NetBSD statvfs structure to Linux statfs64 structure.
* See comments in bsd_to_linux_statfs() for further background.
diff --git a/sys/compat/linux/common/linux_mmap.h b/sys/compat/linux/common/linux_mmap.h
index cbe64a99481..3fa4133c8e1 100644
--- a/sys/compat/linux/common/linux_mmap.h
+++ b/sys/compat/linux/common/linux_mmap.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_mmap.h,v 1.15 2003/06/23 21:26:00 christos Exp $ */
+/* $NetBSD: linux_mmap.h,v 1.16 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -59,6 +59,8 @@
#include <compat/linux/arch/mips/linux_mmap.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_mmap.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_mmap.h>
/*
* XXX ERH: All below here are guesses. The header
* XXX ERH: files are correct but the defined(*)
diff --git a/sys/compat/linux/common/linux_prctl.h b/sys/compat/linux/common/linux_prctl.h
new file mode 100644
index 00000000000..9eb884dd5d2
--- /dev/null
+++ b/sys/compat/linux/common/linux_prctl.h
@@ -0,0 +1,44 @@
+/* $NetBSD: linux_prctl.h,v 1.1 2005/05/03 16:26:29 manu Exp $ */
+
+/*-
+ * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Emmanuel Dreyfus
+ * 4. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINUX_PRCTL_H
+#define _LINUX_PRCTL_H
+
+/* arch independant prctl(2): not yet implemnted */
+
+/* arch specific arch_prctl(2): only on amd64 so far */
+#if defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_prctl.h>
+#endif
+
+#endif /* !_LINUX_PRCTL_H */
diff --git a/sys/compat/linux/common/linux_sig_notalpha.c b/sys/compat/linux/common/linux_sig_notalpha.c
index b9f0056cddc..354a5afe960 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.28 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_sig_notalpha.c,v 1.29 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.28 2005/02/26 23:10:19 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.29 2005/05/03 16:26:29 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sig_notalpha.c,v 1.28 2005/02/26 23:10:19 perr
/* Used on: arm, i386, m68k, mips, sparc, sparc64 */
/* Not used on: alpha */
+#if !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.
@@ -95,7 +96,7 @@ linux_sys_signal(l, v, retval)
error = sigaction1(p, linux_to_native_signo[sig],
&nbsa, &obsa, NULL, 0);
if (error == 0)
- *retval = (int)obsa.sa_handler;
+ *retval = (int)(long)obsa.sa_handler; /* XXXmanu cast */
return (error);
}
@@ -165,6 +166,7 @@ linux_sys_sigprocmask(l, v, retval)
return(linux_sigprocmask1(p, SCARG(uap, how),
SCARG(uap, set), SCARG(uap, oset)));
}
+#endif /* !__amd64__ */
/*
* The deprecated pause(2), which is really just an instance
diff --git a/sys/compat/linux/common/linux_sigaction.c b/sys/compat/linux/common/linux_sigaction.c
index 4a2ccf0a88c..349f1a5e4f8 100644
--- a/sys/compat/linux/common/linux_sigaction.c
+++ b/sys/compat/linux/common/linux_sigaction.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sigaction.c,v 1.25 2003/01/18 21:21:32 thorpej Exp $ */
+/* $NetBSD: linux_sigaction.c,v 1.26 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sigaction.c,v 1.25 2003/01/18 21:21:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sigaction.c,v 1.26 2005/05/03 16:26:29 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -62,8 +62,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sigaction.c,v 1.25 2003/01/18 21:21:32 thorpej
#include <compat/linux/linux_syscallargs.h>
/* Used on: alpha (aka osf_sigaction), arm, i386, m68k, mips, ppc */
-/* Not used on: sparc, sparc64 */
+/* Not used on: sparc, sparc64, amd64 */
+#ifndef __amd64__
/*
* The Linux sigaction() system call. Do the usual conversions,
* and just call sigaction().
@@ -116,3 +117,4 @@ linux_sys_sigaction(l, v, retval)
}
return (0);
}
+#endif /* !amd64 */
diff --git a/sys/compat/linux/common/linux_siginfo.h b/sys/compat/linux/common/linux_siginfo.h
index 1550fc48df8..9f33e5021e9 100644
--- a/sys/compat/linux/common/linux_siginfo.h
+++ b/sys/compat/linux/common/linux_siginfo.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_siginfo.h,v 1.7 2002/09/05 22:27:36 christos Exp $ */
+/* $NetBSD: linux_siginfo.h,v 1.8 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -51,6 +51,8 @@
#include <compat/linux/arch/mips/linux_siginfo.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_siginfo.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_siginfo.h>
#endif
#endif /* !_LINUX_SIGINFO_H */
diff --git a/sys/compat/linux/common/linux_signal.c b/sys/compat/linux/common/linux_signal.c
index de76ced5790..ff61f0e9c75 100644
--- a/sys/compat/linux/common/linux_signal.c
+++ b/sys/compat/linux/common/linux_signal.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_signal.c,v 1.42 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_signal.c,v 1.43 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.42 2005/02/26 23:10:19 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.43 2005/05/03 16:26:29 manu Exp $");
#define COMPAT_LINUX 1
@@ -134,7 +134,7 @@ native_to_linux_old_extra_sigset(lss, extra, bss)
memcpy(extra, &lsnew.sig[1],
sizeof(linux_sigset_t) - sizeof(linux_old_sigset_t));
}
-#endif
+#endif /* LINUX__NSIG_WORDS > 1 */
void
linux_to_native_sigset(bss, lss)
@@ -236,7 +236,7 @@ linux_old_to_native_sigaction(bsa, lsa)
if (lsa->linux_sa_restorer != NULL)
DPRINTF(("linux_old_to_native_sigaction: "
"sa_restorer ignored\n"));
-#endif
+#endif /* !__alpha__ */
}
void
@@ -457,6 +457,7 @@ linux_sys_rt_sigpending(l, v, retval)
return copyout(&lss, SCARG(uap, set), sizeof(lss));
}
+#ifndef __amd64__
int
linux_sys_sigpending(l, v, retval)
struct lwp *l;
@@ -494,6 +495,8 @@ linux_sys_sigsuspend(l, v, retval)
linux_old_to_native_sigset(&bss, &lss);
return (sigsuspend1(p, &bss));
}
+#endif /* __amd64__ */
+
int
linux_sys_rt_sigsuspend(l, v, retval)
struct lwp *l;
@@ -600,6 +603,7 @@ native_to_linux_sigaltstack(lss, bss)
else
lss->ss_flags = 0;
}
+#endif /* LINUX_SS_ONSTACK */
int
linux_sys_sigaltstack(l, v, retval)
@@ -634,4 +638,3 @@ linux_sys_sigaltstack(l, v, retval)
}
return 0;
}
-#endif
diff --git a/sys/compat/linux/common/linux_signal.h b/sys/compat/linux/common/linux_signal.h
index f921af23d61..f25517640bd 100644
--- a/sys/compat/linux/common/linux_signal.h
+++ b/sys/compat/linux/common/linux_signal.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_signal.h,v 1.21 2003/08/08 18:55:26 christos Exp $ */
+/* $NetBSD: linux_signal.h,v 1.22 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -51,6 +51,8 @@
#include <compat/linux/arch/mips/linux_signal.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_signal.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_signal.h>
#endif
#ifdef _KERNEL
@@ -72,10 +74,11 @@ void native_to_linux_old_extra_sigset __P((linux_old_sigset_t *,
#else /* LINUX__NSIG_WORDS == 1 */
+/* XXXmanu (const linux_sigset_t *)(void *) temporary hack to get it building */
#define linux_old_to_native_sigset(x,y) \
- linux_to_native_sigset(x, (const linux_sigset_t *)y)
+ linux_to_native_sigset(x, (const linux_sigset_t *)(void *)y)
#define native_to_linux_old_sigset(x,y) \
- native_to_linux_sigset((linux_sigset_t *)x, y)
+ native_to_linux_sigset((linux_sigset_t *)(void *)x, y)
#endif
#ifdef LINUX_SS_ONSTACK
diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c
index 8bdba2ff889..c5a56c24192 100644
--- a/sys/compat/linux/common/linux_socket.c
+++ b/sys/compat/linux/common/linux_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.55 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_socket.c,v 1.56 2005/05/03 16:26:29 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.55 2005/02/26 23:10:19 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.56 2005/05/03 16:26:29 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1618,6 +1618,7 @@ linux_sa_put(osa)
return (0);
}
+#ifndef __amd64__
int
linux_sys_recv(l, v, retval)
struct lwp *l;
@@ -1666,6 +1667,7 @@ linux_sys_send(l, v, retval)
return (sys_sendto(l, &bsa, retval));
}
+#endif /* __amd64__ */
int
linux_sys_accept(l, v, retval)
diff --git a/sys/compat/linux/common/linux_socket.h b/sys/compat/linux/common/linux_socket.h
index a9e330e26ac..9f4c4aed261 100644
--- a/sys/compat/linux/common/linux_socket.h
+++ b/sys/compat/linux/common/linux_socket.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.h,v 1.11 2003/07/27 19:30:03 jdolecek Exp $ */
+/* $NetBSD: linux_socket.h,v 1.12 2005/05/03 16:26:30 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -185,6 +185,8 @@
#include <compat/linux/arch/mips/linux_socket.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_socket.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_socket.h>
#else
#error Undefined linux_socket.h machine type.
#endif
diff --git a/sys/compat/linux/common/linux_socketcall.c b/sys/compat/linux/common/linux_socketcall.c
index 7b2b9b4368f..883e196f290 100644
--- a/sys/compat/linux/common/linux_socketcall.c
+++ b/sys/compat/linux/common/linux_socketcall.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socketcall.c,v 1.27 2004/09/05 09:09:02 jdolecek Exp $ */
+/* $NetBSD: linux_socketcall.c,v 1.28 2005/05/03 16:26:30 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.27 2004/09/05 09:09:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.28 2005/05/03 16:26:30 manu Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -80,7 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.27 2004/09/05 09:09:02 jdolec
#endif
/* Used on: arm, i386, m68k, mips, ppc, sparc, sparc64 */
-/* Not used on: alpha */
+/* Not used on: alpha, amd64 */
/*
* This file contains the linux_socketcall() multiplexer. Arguments
diff --git a/sys/compat/linux/common/linux_socketcall.h b/sys/compat/linux/common/linux_socketcall.h
index d9edbc46b8f..a3d4de75d9c 100644
--- a/sys/compat/linux/common/linux_socketcall.h
+++ b/sys/compat/linux/common/linux_socketcall.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socketcall.h,v 1.8 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_socketcall.h,v 1.9 2005/05/03 16:26:30 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
#define _LINUX_SOCKETCALL_H
/* Alpha does not use the socketcall multiplexer */
-#if !defined(__alpha__)
+#if !defined(__alpha__) && !defined(__amd64__)
/* Used on: arm, i386, m68k, mips, ppc, sparc, sparc64 */
/* Not used on: alpha */
diff --git a/sys/compat/linux/common/linux_termios.h b/sys/compat/linux/common/linux_termios.h
index 822fb5f05df..55ee235ca41 100644
--- a/sys/compat/linux/common/linux_termios.h
+++ b/sys/compat/linux/common/linux_termios.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_termios.h,v 1.12 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_termios.h,v 1.13 2005/05/03 16:26:30 manu Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -51,6 +51,8 @@
#include <compat/linux/arch/mips/linux_termios.h>
#elif defined(__arm__)
#include <compat/linux/arch/arm/linux_termios.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_termios.h>
#else
#error Undefined linux_termios.h machine type.
#endif
diff --git a/sys/compat/linux/common/linux_time.c b/sys/compat/linux/common/linux_time.c
index ca9e899987d..979412db5b4 100644
--- a/sys/compat/linux/common/linux_time.c
+++ b/sys/compat/linux/common/linux_time.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_time.c,v 1.9 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_time.c,v 1.10 2005/05/03 16:26:30 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.9 2005/02/26 23:10:19 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.10 2005/05/03 16:26:30 manu Exp $");
#include <sys/param.h>
#include <sys/ucred.h>
@@ -58,7 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.9 2005/02/26 23:10:19 perry Exp $")
* This is not implemented for alpha yet
*/
#if defined (__i386__) || defined (__m68k__) || \
- defined (__powerpc__) || defined (__mips__) || defined(__arm__)
+ defined (__powerpc__) || defined (__mips__) || \
+ defined(__arm__) || defined(__amd64__)
/*
* Linux keeps track of a system timezone in the kernel. It is readen
diff --git a/sys/compat/linux/common/linux_types.h b/sys/compat/linux/common/linux_types.h
index 0db5bed3f7d..5cfd38004c1 100644
--- a/sys/compat/linux/common/linux_types.h
+++ b/sys/compat/linux/common/linux_types.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_types.h,v 1.21 2005/02/26 23:10:19 perry Exp $ */
+/* $NetBSD: linux_types.h,v 1.22 2005/05/03 16:26:30 manu Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -51,6 +51,8 @@
#include <compat/linux/arch/m68k/linux_types.h>
#elif defined(__mips__)
#include <compat/linux/arch/mips/linux_types.h>
+#elif defined(__amd64__)
+#include <compat/linux/arch/amd64/linux_types.h>
#else
typedef unsigned long linux_clock_t;
typedef unsigned long linux_time_t;