public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo commit in src/patchsets/gentoo-headers/3.2: 00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch 00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch 00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch 00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch 00_all_0005-netfilter-pull-in-limits.h.patch 00_all_0006-convert-PAGE_SIZE-usage.patch 00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch 00_all_0008-unifdef-drop-unused-errno.h-include.patch 90_all_x32-3.2.patch
@ 2012-01-07  4:26 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2012-01-07  4:26 UTC (permalink / raw
  To: gentoo-commits

vapier      12/01/07 04:26:36

  Added:               
                        00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch
                        00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch
                        00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch
                        00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch
                        00_all_0005-netfilter-pull-in-limits.h.patch
                        00_all_0006-convert-PAGE_SIZE-usage.patch
                        00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch
                        00_all_0008-unifdef-drop-unused-errno.h-include.patch
                        90_all_x32-3.2.patch
  Log:
  initial 3.2 patchset based on last 3.1 patchset

Revision  Changes    Path
1.1                  src/patchsets/gentoo-headers/3.2/00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch?rev=1.1&content-type=text/plain

Index: 00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch
===================================================================
From 67e13cb3835e984a1398c8636c4c26d2bac91596 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 29 Dec 2008 06:07:47 -0500
Subject: [PATCH] kbuild: auto-convert size types in userspace headers

Rather than constantly fixing up size type breakage in userspace headers,
auto convert the types u_intXX_t, uintXX_t, intXX_t, uXX, and sXX to the
appropriate __uXX or __sXX type.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 scripts/headers_install.pl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 48462be..92101b9 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -40,6 +40,9 @@ foreach my $file (@files) {
 		$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
 		$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
 		$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
+		$line =~ s/\b([us](8|16|32|64))\b/__$1/g;
+		$line =~ s/\b(u_?int(8|16|32|64)_t)\b/__u$2/g;
+		$line =~ s/\b(int(8|16|32|64)_t)\b/__s$2/g;
 		printf {$out} "%s", $line;
 	}
 	close $out;
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch?rev=1.1&content-type=text/plain

Index: 00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch
===================================================================
From 23c414c8c84621ce601c886cfda5fcac52576e0e Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 29 Dec 2008 06:52:59 -0500
Subject: [PATCH] linux/stat.h: remove __GLIBC__ checks

Only check __KERNEL__ so we don't assume the C library is glibc.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/linux/stat.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/stat.h b/include/linux/stat.h
index 611c398..5460344 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -7,7 +7,7 @@
 
 #endif
 
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#ifdef __KERNEL__
 
 #define S_IFMT  00170000
 #define S_IFSOCK 0140000
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch?rev=1.1&content-type=text/plain

Index: 00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch
===================================================================
From 573d78f37c21fe5ce80dce1ce955cd78537c2e43 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 2 Jan 2009 02:34:03 -0500
Subject: [PATCH] linux/stddef.h: export offsetof() to userspace

Some userspace headers (like fuse.h) utilize the offsetof() macro.  Some
userspace packages (like lkcd) expect linux/stddef.h to provide this as
well.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/linux/stddef.h |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index 6a40c76..4894d59 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -20,9 +20,12 @@ enum {
 #undef offsetof
 #ifdef __compiler_offsetof
 #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 #endif
 #endif /* __KERNEL__ */
 
+#include <stddef.h> /* newer gcc includes this */
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
 #endif
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch?rev=1.1&content-type=text/plain

Index: 00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch
===================================================================
From 07acc7fe9a642bb2be0f934fe4d2a5e72bc83be9 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 29 Dec 2008 07:41:01 -0500
Subject: [PATCH] linux/*: pull in other needed headers for userspace

mondo patch

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/linux/cm4000_cs.h |    1 +
 include/linux/dn.h        |    1 +
 include/linux/if_ppp.h    |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/linux/cm4000_cs.h b/include/linux/cm4000_cs.h
index 3c4aac4..ac230b6 100644
--- a/include/linux/cm4000_cs.h
+++ b/include/linux/cm4000_cs.h
@@ -2,6 +2,7 @@
 #define	_CM4000_H_
 
 #include <linux/types.h>
+#include <linux/ioctl.h>
 
 #define	MAX_ATR			33
 
diff --git a/include/linux/dn.h b/include/linux/dn.h
index 9c50445..dc9f005 100644
--- a/include/linux/dn.h
+++ b/include/linux/dn.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_DN_H
 #define _LINUX_DN_H
 
+#include <linux/ioctl.h>
 #include <linux/types.h>
 
 /*
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index c9ad383..4d70e16 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -35,6 +35,7 @@
 
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <linux/ppp_defs.h>
 
 /*
  * Packet sizes
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0005-netfilter-pull-in-limits.h.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0005-netfilter-pull-in-limits.h.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0005-netfilter-pull-in-limits.h.patch?rev=1.1&content-type=text/plain

Index: 00_all_0005-netfilter-pull-in-limits.h.patch
===================================================================
From 327051eec20d0a19dcba38b22d5a4644af6de2ef Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 9 May 2009 17:30:35 -0400
Subject: [PATCH] netfilter: pull in limits.h

A few netfilter sub-headers use INT_MAX which is in limits.h.

URL: http://bugs.gentoo.org/246160
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/linux/netfilter.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 857f502..7f47d46 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/sysctl.h>
+#include <limits.h>
 
 /* Responses from hook functions. */
 #define NF_DROP 0
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0006-convert-PAGE_SIZE-usage.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0006-convert-PAGE_SIZE-usage.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0006-convert-PAGE_SIZE-usage.patch?rev=1.1&content-type=text/plain

Index: 00_all_0006-convert-PAGE_SIZE-usage.patch
===================================================================
From 33f15f396dcfccc585adaf1157050f83e3f049d4 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 13 Feb 2010 03:09:23 -0500
Subject: [PATCH] convert PAGE_SIZE usage

The size of a page may change at runtime or based on kernel settings, so
a static value at compile time doesn't work.  More importantly, no one
exports PAGE_SIZE to user space anymore.

URL: http://bugs.gentoo.org/301431
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/linux/binfmts.h  |    3 ++-
 include/linux/resource.h |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index fd88a39..dbe6719 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_BINFMTS_H
 #define _LINUX_BINFMTS_H
 
+#include <unistd.h>
 #include <linux/capability.h>
 
 struct pt_regs;
@@ -11,7 +12,7 @@ struct pt_regs;
  * prevent the kernel from being unduly impacted by misaddressed pointers.
  * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
  */
-#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
+#define MAX_ARG_STRLEN (sysconf(_SC_PAGESIZE) * 32)
 #define MAX_ARG_STRINGS 0x7FFFFFFF
 
 /* sizeof(linux_binprm->buf) */
diff --git a/include/linux/resource.h b/include/linux/resource.h
index d01c96c..5a0559d 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -68,7 +68,8 @@ struct rlimit64 {
  * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
  * and other sensitive information are never written to disk.
  */
-#define MLOCK_LIMIT	((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
+/* No one currently defines PAGE_SIZE bigger than 64kB */
+#define MLOCK_LIMIT	(64 * 1024)
 
 /*
  * Due to binary compatibility, the actual resource numbers
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch?rev=1.1&content-type=text/plain

Index: 00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch
===================================================================
From c9fe447c4cf5db1534ea702e6611013bc42a98e0 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 29 Dec 2008 07:39:14 -0500
Subject: [PATCH] asm-generic/fcntl.h: namespace kernel file structs

No one should be using these structs, but just in case they are,
keep them available in the __kernel_ namespace.

Otherwise, trying to include something like:
	#include <fcntl.h>
	#include <linux/inotify.h>
leads to horrible failure.

URL: http://bugs.gentoo.org/244470
URL: http://bugs.gentoo.org/388633
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/asm-generic/fcntl.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index 9e5b035..fc2dba0 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -124,7 +124,7 @@
 #define F_OWNER_PID	1
 #define F_OWNER_PGRP	2
 
-struct f_owner_ex {
+struct __kernel_f_owner_ex {
 	int	type;
 	__kernel_pid_t	pid;
 };
@@ -164,7 +164,7 @@ struct f_owner_ex {
 #define __ARCH_FLOCK_PAD
 #endif
 
-struct flock {
+struct __kernel_flock {
 	short	l_type;
 	short	l_whence;
 	__kernel_off_t	l_start;
@@ -181,7 +181,7 @@ struct flock {
 #define __ARCH_FLOCK64_PAD
 #endif
 
-struct flock64 {
+struct __kernel_flock64 {
 	short  l_type;
 	short  l_whence;
 	__kernel_loff_t l_start;
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/00_all_0008-unifdef-drop-unused-errno.h-include.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0008-unifdef-drop-unused-errno.h-include.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/00_all_0008-unifdef-drop-unused-errno.h-include.patch?rev=1.1&content-type=text/plain

Index: 00_all_0008-unifdef-drop-unused-errno.h-include.patch
===================================================================
From e3d85878dbc208a60a342420d50ae631e30a3cf9 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 6 Dec 2011 17:22:42 -0500
Subject: [PATCH] unifdef: drop unused errno.h include

This is the only header on my system that ends up requiring kernel
headers, so if the kernel headers aren't available, we end up being
unable to install kernel headers :).

Since this file doesn't actually use anything from errno.h, drop
the include so it at least makes us a bit more robust on glibc.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 scripts/unifdef.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 7493c0e..c5dfae5 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -48,7 +48,6 @@
 
 #include <ctype.h>
 #include <err.h>
-#include <errno.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
-- 
1.7.6.1




1.1                  src/patchsets/gentoo-headers/3.2/90_all_x32-3.2.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/90_all_x32-3.2.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gentoo-headers/3.2/90_all_x32-3.2.patch?rev=1.1&content-type=text/plain

Index: 90_all_x32-3.2.patch
===================================================================
add x32 support; patch from https://github.com/hjl-tools/linux

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index b02e509..9083bf23 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -157,7 +157,7 @@ all: bzImage
 # KBUILD_IMAGE specify target image being built
 KBUILD_IMAGE := $(boot)/bzImage
 
-bzImage: vmlinux
+bzImage: vmlinux arch/x86/include/asm/unistd_x32.h
 ifeq ($(CONFIG_X86_DECODER_SELFTEST),y)
 	$(Q)$(MAKE) $(build)=arch/x86/tools posttest
 endif
@@ -176,6 +176,11 @@ PHONY += vdso_install
 vdso_install:
 	$(Q)$(MAKE) $(build)=arch/x86/vdso $@
 
+arch/x86/include/asm/unistd_x32.h: arch/x86/include/asm/unistd_64.h
+	sed -e "s/_NR_x32_/_NR_/g" \
+	    -e "s/_ASM_X86_UNISTD_64_H/_ASM_X86_UNISTD_X32_H/g" \
+	    $^ | grep -v "__NR_64_" > $@
+
 archclean:
 	$(Q)rm -rf $(objtree)/arch/i386
 	$(Q)rm -rf $(objtree)/arch/x86_64
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 6fa90a8..8d36523 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -21,5 +21,6 @@ header-y += sigcontext32.h
 header-y += ucontext.h
 header-y += unistd_32.h
 header-y += unistd_64.h
+header-y += unistd_x32.h
 header-y += vm86.h
 header-y += vsyscall.h
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 30d737e..f6bf9ca 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -6,7 +6,12 @@
  */
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/percpu.h>
+#include <asm/processor.h>
 #include <asm/user32.h>
+#ifdef CONFIG_X86_X32_ABI
+#include <asm/unistd.h>
+#endif
 
 #define COMPAT_USER_HZ		100
 #define COMPAT_UTS_MACHINE	"i686\0\0"
@@ -186,7 +191,20 @@ struct compat_shmid64_ds {
 /*
  * The type of struct elf_prstatus.pr_reg in compatible core dumps.
  */
+#ifdef CONFIG_X86_X32_ABI
+typedef struct user_regs_struct compat_elf_gregset_t;
+
+#define PR_REG_SIZE(S) (test_thread_flag(TIF_IA32) ? 68 : 216)
+#define PRSTATUS_SIZE(S) (test_thread_flag(TIF_IA32) ? 144 : 296)
+#define SET_PR_FPVALID(S,V) \
+  do { *(int *) (((void *) &((S)->pr_reg)) + PR_REG_SIZE(0)) = (V); } \
+  while (0)
+
+#define COMPAT_USE_64BIT_TIME \
+  ((task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT) != 0)
+#else
 typedef struct user_regs_struct32 compat_elf_gregset_t;
+#endif
 
 /*
  * A pointer passed in from user mode. This should not
@@ -208,13 +226,29 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
 
 static inline void __user *arch_compat_alloc_user_space(long len)
 {
+#ifdef CONFIG_X86_X32_ABI
+	compat_uptr_t sp;
+
+	if (test_thread_flag(TIF_IA32))
+		sp = task_pt_regs(current)->sp;
+	else
+		sp = percpu_read(old_rsp);
+
+	/* -128 for the x32 ABI redzone */
+	return (void __user *)round_down(sp - len - 128, 16);
+#else
 	struct pt_regs *regs = task_pt_regs(current);
 	return (void __user *)regs->sp - len;
+#endif
 }
 
 static inline int is_compat_task(void)
 {
-	return current_thread_info()->status & TS_COMPAT;
+	return (current_thread_info()->status & TS_COMPAT)
+#ifdef CONFIG_X86_X32_ABI
+	       || (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
+#endif
+		;
 }
 
 #endif /* _ASM_X86_COMPAT_H */
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 5f962df..83aabea 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -156,7 +156,12 @@ do {						\
 #define elf_check_arch(x)			\
 	((x)->e_machine == EM_X86_64)
 
-#define compat_elf_check_arch(x)	elf_check_arch_ia32(x)
+#define compat_elf_check_arch(x)		\
+	(elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
+
+#if __USER32_DS != __USER_DS
+# error "The following code assumes __USER32_DS == __USER_DS"
+#endif
 
 static inline void elf_common_init(struct thread_struct *t,
 				   struct pt_regs *regs, const u16 ds)
@@ -179,8 +184,9 @@ static inline void elf_common_init(struct thread_struct *t,
 void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp);
 #define compat_start_thread start_thread_ia32
 
-void set_personality_ia32(void);
-#define COMPAT_SET_PERSONALITY(ex) set_personality_ia32()
+void set_personality_ia32(bool);
+#define COMPAT_SET_PERSONALITY(ex)			\
+	set_personality_ia32((ex).e_machine == EM_X86_64)
 
 #define COMPAT_ELF_PLATFORM			("i686")
 
@@ -287,7 +293,7 @@ do {									\
 #define VDSO_HIGH_BASE		0xffffe000U /* CONFIG_COMPAT_VDSO address */
 
 /* 1GB for 64bit, 8MB for 32bit */
-#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff)
+#define STACK_RND_MASK (test_thread_flag(TIF_ADDR32) ? 0x7ff : 0x3fffff)
 
 #define ARCH_DLINFO							\
 do {									\
@@ -296,9 +302,20 @@ do {									\
 			    (unsigned long)current->mm->context.vdso);	\
 } while (0)
 
+#define ARCH_DLINFO_X32							\
+do {									\
+	if (vdso_enabled)						\
+		NEW_AUX_ENT(AT_SYSINFO_EHDR,				\
+			    (unsigned long)current->mm->context.vdso);	\
+} while (0)
+
 #define AT_SYSINFO		32
 
-#define COMPAT_ARCH_DLINFO	ARCH_DLINFO_IA32(sysctl_vsyscall32)
+#define COMPAT_ARCH_DLINFO						\
+if (test_thread_flag(TIF_X32))						\
+	ARCH_DLINFO_X32;						\
+else									\
+	ARCH_DLINFO_IA32(sysctl_vsyscall32)
 
 #define COMPAT_ELF_ET_DYN_BASE	(TASK_UNMAPPED_BASE + 0x1000000)
 
@@ -330,7 +347,7 @@ static inline int mmap_is_ia32(void)
 	return 1;
 #endif
 #ifdef CONFIG_IA32_EMULATION
-	if (test_thread_flag(TIF_IA32))
+	if (test_thread_flag(TIF_ADDR32))
 		return 1;
 #endif
 	return 0;
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 1f7e625..c6435ab 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -43,6 +43,15 @@ struct ucontext_ia32 {
 	compat_sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
+struct ucontext_x32 {
+	unsigned int	  uc_flags;
+	unsigned int 	  uc_link;
+	stack_ia32_t	  uc_stack;
+	unsigned int	  uc__pad0;     /* needed for alignment */
+	struct sigcontext uc_mcontext;  /* the 64-bit sigcontext type */
+	compat_sigset_t	  uc_sigmask;	/* mask last for extensibility */
+};
+
 /* This matches struct stat64 in glibc2.2, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index 4365ffd..300cdcd 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -40,7 +40,7 @@ struct mtrr_sentry {
    But you need to use this for 64bit, otherwise your X server
    will break. */
 
-#ifdef __i386__
+#ifndef __LP64__
 struct mtrr_gentry {
     unsigned int regnum;   /*  Register number  */
     unsigned long base;    /*  Base address     */
@@ -48,7 +48,7 @@ struct mtrr_gentry {
     unsigned int type;     /*  Type of region   */
 };
 
-#else /* __i386__ */
+#else /* !__LP64__ */
 
 struct mtrr_gentry {
     unsigned long base;    /*  Base address     */
@@ -56,7 +56,7 @@ struct mtrr_gentry {
     unsigned int regnum;   /*  Register number  */
     unsigned int type;     /*  Type of region   */
 };
-#endif /* !__i386__ */
+#endif /* __LP64__ */
 
 struct mtrr_var_range {
 	__u32 base_lo;
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index b650435..11c7c38 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -926,9 +926,9 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
 #define IA32_PAGE_OFFSET	((current->personality & ADDR_LIMIT_3GB) ? \
 					0xc0000000 : 0xFFFFe000)
 
-#define TASK_SIZE		(test_thread_flag(TIF_IA32) ? \
+#define TASK_SIZE		(test_thread_flag(TIF_ADDR32) ? \
 					IA32_PAGE_OFFSET : TASK_SIZE_MAX)
-#define TASK_SIZE_OF(child)	((test_tsk_thread_flag(child, TIF_IA32)) ? \
+#define TASK_SIZE_OF(child)	((test_tsk_thread_flag(child, TIF_ADDR32)) ? \
 					IA32_PAGE_OFFSET : TASK_SIZE_MAX)
 
 #define STACK_TOP		TASK_SIZE
@@ -950,6 +950,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
 
 #define task_pt_regs(tsk)	((struct pt_regs *)(tsk)->thread.sp0 - 1)
 extern unsigned long KSTK_ESP(struct task_struct *task);
+
+/*
+ * User space RSP while inside the SYSCALL fast path
+ */
+DECLARE_PER_CPU(unsigned long, old_rsp);
 #endif /* CONFIG_X86_64 */
 
 extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 3566454..dcb2aac 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -67,30 +67,30 @@ struct pt_regs {
 #ifndef __KERNEL__
 
 struct pt_regs {
-	unsigned long r15;
-	unsigned long r14;
-	unsigned long r13;
-	unsigned long r12;
-	unsigned long rbp;
-	unsigned long rbx;
+	__u64 r15;
+	__u64 r14;
+	__u64 r13;
+	__u64 r12;
+	__u64 rbp;
+	__u64 rbx;
 /* arguments: non interrupts/non tracing syscalls only save up to here*/
-	unsigned long r11;
-	unsigned long r10;
-	unsigned long r9;
-	unsigned long r8;
-	unsigned long rax;
-	unsigned long rcx;
-	unsigned long rdx;
-	unsigned long rsi;
-	unsigned long rdi;
-	unsigned long orig_rax;
+	__u64 r11;
+	__u64 r10;
+	__u64 r9;
+	__u64 r8;
+	__u64 rax;
+	__u64 rcx;
+	__u64 rdx;
+	__u64 rsi;
+	__u64 rdi;
+	__u64 orig_rax;
 /* end of arguments */
 /* cpu exception frame or undefined */
-	unsigned long rip;
-	unsigned long cs;
-	unsigned long eflags;
-	unsigned long rsp;
-	unsigned long ss;
+	__u64 rip;
+	__u64 cs;
+	__u64 eflags;
+	__u64 rsp;
+	__u64 ss;
 /* top of stack page */
 };
 
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 04459d2..4a08538 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -230,34 +230,37 @@ struct sigcontext {
  * User-space might still rely on the old definition:
  */
 struct sigcontext {
-	unsigned long r8;
-	unsigned long r9;
-	unsigned long r10;
-	unsigned long r11;
-	unsigned long r12;
-	unsigned long r13;
-	unsigned long r14;
-	unsigned long r15;
-	unsigned long rdi;
-	unsigned long rsi;
-	unsigned long rbp;
-	unsigned long rbx;
-	unsigned long rdx;
-	unsigned long rax;
-	unsigned long rcx;
-	unsigned long rsp;
-	unsigned long rip;
-	unsigned long eflags;		/* RFLAGS */
-	unsigned short cs;
-	unsigned short gs;
-	unsigned short fs;
-	unsigned short __pad0;
-	unsigned long err;
-	unsigned long trapno;
-	unsigned long oldmask;
-	unsigned long cr2;
+	__u64 r8;
+	__u64 r9;
+	__u64 r10;
+	__u64 r11;
+	__u64 r12;
+	__u64 r13;
+	__u64 r14;
+	__u64 r15;
+	__u64 rdi;
+	__u64 rsi;
+	__u64 rbp;
+	__u64 rbx;
+	__u64 rdx;
+	__u64 rax;
+	__u64 rcx;
+	__u64 rsp;
+	__u64 rip;
+	__u64 eflags;		/* RFLAGS */
+	__u16 cs;
+	__u16 gs;
+	__u16 fs;
+	__u16 __pad0;
+	__u64 err;
+	__u64 trapno;
+	__u64 oldmask;
+	__u64 cr2;
 	struct _fpstate __user *fpstate;	/* zero when no FPU context */
-	unsigned long reserved1[8];
+#ifndef __LP64__
+	__u32 __fpstate_pad;
+#endif
+	__u64 reserved1[8];
 };
 #endif /* !__KERNEL__ */
 
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 4e0fe26..22cfab8 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -59,6 +59,17 @@ struct rt_sigframe_ia32 {
 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */
 
 #ifdef CONFIG_X86_64
+
+#ifdef CONFIG_X86_X32_ABI
+struct rt_sigframe_x32 {
+	u64 pretcode;
+	struct ucontext_x32 uc;
+	compat_siginfo_t info;
+	/* fp state follows here */
+};
+
+#endif /* CONFIG_X86_X32_ABI */
+
 struct rt_sigframe {
 	char __user *pretcode;
 	struct ucontext uc;
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index c4a348f..2f44f27b 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -15,6 +15,9 @@
 
 #include <linux/sched.h>
 #include <linux/err.h>
+#ifdef CONFIG_X86_X32_ABI
+#include <asm/unistd.h>
+#endif
 
 extern const unsigned long sys_call_table[];
 
@@ -25,13 +28,21 @@ extern const unsigned long sys_call_table[];
  */
 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
 {
-	return regs->orig_ax;
+	return regs->orig_ax
+#ifdef CONFIG_X86_X32_ABI
+	       & ~__X32_SYSCALL_BIT
+#endif
+		;
 }
 
 static inline void syscall_rollback(struct task_struct *task,
 				    struct pt_regs *regs)
 {
-	regs->ax = regs->orig_ax;
+	regs->ax = regs->orig_ax
+#ifdef CONFIG_X86_X32_ABI
+		  & ~__X32_SYSCALL_BIT
+#endif
+		;
 }
 
 static inline long syscall_get_error(struct task_struct *task,
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index a1fe5c1..4e076b0 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -85,7 +85,7 @@ struct thread_info {
 #define TIF_MCE_NOTIFY		10	/* notify userspace of an MCE */
 #define TIF_USER_RETURN_NOTIFY	11	/* notify kernel of userspace return */
 #define TIF_NOTSC		16	/* TSC is not accessible in userland */
-#define TIF_IA32		17	/* 32bit process */
+#define TIF_IA32		17	/* ia32 process */
 #define TIF_FORK		18	/* ret_from_fork */
 #define TIF_MEMDIE		20	/* is terminating due to OOM killer */
 #define TIF_DEBUG		21	/* uses debug registers */
@@ -95,6 +95,8 @@ struct thread_info {
 #define TIF_BLOCKSTEP		25	/* set when we want DEBUGCTLMSR_BTF */
 #define TIF_LAZY_MMU_UPDATES	27	/* task is updating the mmu lazily */
 #define TIF_SYSCALL_TRACEPOINT	28	/* syscall tracepoint instrumentation */
+#define TIF_ADDR32		29	/* 32bit process */
+#define TIF_X32			30	/* 32-bit native x86-64 binary */
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
@@ -117,6 +119,8 @@ struct thread_info {
 #define _TIF_BLOCKSTEP		(1 << TIF_BLOCKSTEP)
 #define _TIF_LAZY_MMU_UPDATES	(1 << TIF_LAZY_MMU_UPDATES)
 #define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
+#define _TIF_ADDR32		(1 << TIF_ADDR32)
+#define _TIF_X32		(1 << TIF_X32)
 
 /* work to do in syscall_trace_enter() */
 #define _TIF_WORK_SYSCALL_ENTRY	\
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 8e8c23f..f013125 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -1,6 +1,12 @@
 #ifndef _ASM_X86_TYPES_H
 #define _ASM_X86_TYPES_H
 
+#if defined __x86_64__ && !defined __LP64__
+#define __KERNEL_NATIVE_LONG_TYPE long long
+#else
+#define __KERNEL_NATIVE_LONG_TYPE long
+#endif
+
 #include <asm-generic/types.h>
 
 #endif /* _ASM_X86_TYPES_H */
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 2a58ed3..e9c1b26 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -3,11 +3,14 @@
 #  include "unistd_32.h"
 # else
 #  include "unistd_64.h"
+#  include "unistd_64_compat.h"
 # endif
 #else
 # ifdef __i386__
 #  include "unistd_32.h"
-# else
+# elif __LP64__
 #  include "unistd_64.h"
+# else
+#  include "unistd_x32.h"
 # endif
 #endif
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 0431f19..f59b665 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -5,6 +5,28 @@
 #define __SYSCALL(a, b)
 #endif
 
+#ifndef __X32_SYSCALL
+#define __X32_SYSCALL(a, b)
+#endif
+
+/* X32 system call mask.  */
+#define __X32_SYSCALL_BIT	0x40000000
+
+/* The first x32 system call.  */
+#define __X32_SYSCALL_BASE	512
+
+#ifdef __KERNEL__
+#define __NR_COMMON_SYSCALL(n)	(n)
+#define __NR_X32_SYSCALL(n)	(__X32_SYSCALL_BASE + n)
+#else
+#if __LP64__
+#define __NR_COMMON_SYSCALL(n)	(n)
+#else
+#define __NR_COMMON_SYSCALL(n)	(__X32_SYSCALL_BIT | (n))
+#endif
+#define __NR_X32_SYSCALL(n)	(__X32_SYSCALL_BIT | (__X32_SYSCALL_BASE + n))
+#endif
+
 /*
  * This file contains the system call numbers.
  *
@@ -12,680 +34,745 @@
  */
 
 /* at least 8 syscall per cacheline */
-#define __NR_read				0
+#define __NR_read				__NR_COMMON_SYSCALL(0)
 __SYSCALL(__NR_read, sys_read)
-#define __NR_write				1
+#define __NR_write				__NR_COMMON_SYSCALL(1)
 __SYSCALL(__NR_write, sys_write)
-#define __NR_open				2
+#define __NR_open				__NR_COMMON_SYSCALL(2)
 __SYSCALL(__NR_open, sys_open)
-#define __NR_close				3
+#define __NR_close				__NR_COMMON_SYSCALL(3)
 __SYSCALL(__NR_close, sys_close)
-#define __NR_stat				4
+#define __NR_stat				__NR_COMMON_SYSCALL(4)
 __SYSCALL(__NR_stat, sys_newstat)
-#define __NR_fstat				5
+#define __NR_fstat				__NR_COMMON_SYSCALL(5)
 __SYSCALL(__NR_fstat, sys_newfstat)
-#define __NR_lstat				6
+#define __NR_lstat				__NR_COMMON_SYSCALL(6)
 __SYSCALL(__NR_lstat, sys_newlstat)
-#define __NR_poll				7
+#define __NR_poll				__NR_COMMON_SYSCALL(7)
 __SYSCALL(__NR_poll, sys_poll)
 
-#define __NR_lseek				8
+#define __NR_lseek				__NR_COMMON_SYSCALL(8)
 __SYSCALL(__NR_lseek, sys_lseek)
-#define __NR_mmap				9
+#define __NR_mmap				__NR_COMMON_SYSCALL(9)
 __SYSCALL(__NR_mmap, sys_mmap)
-#define __NR_mprotect				10
+#define __NR_mprotect				__NR_COMMON_SYSCALL(10)
 __SYSCALL(__NR_mprotect, sys_mprotect)
-#define __NR_munmap				11
+#define __NR_munmap				__NR_COMMON_SYSCALL(11)
 __SYSCALL(__NR_munmap, sys_munmap)
-#define __NR_brk				12
+#define __NR_brk				__NR_COMMON_SYSCALL(12)
 __SYSCALL(__NR_brk, sys_brk)
-#define __NR_rt_sigaction			13
-__SYSCALL(__NR_rt_sigaction, sys_rt_sigaction)
-#define __NR_rt_sigprocmask			14
-__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
-#define __NR_rt_sigreturn			15
-__SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn)
-
-#define __NR_ioctl				16
-__SYSCALL(__NR_ioctl, sys_ioctl)
-#define __NR_pread64				17
+#define __NR_64_rt_sigaction			13
+__SYSCALL(__NR_64_rt_sigaction, sys_rt_sigaction)
+#define __NR_64_rt_sigprocmask			14
+__SYSCALL(__NR_64_rt_sigprocmask, sys_rt_sigprocmask)
+#define __NR_64_rt_sigreturn			15
+__SYSCALL(__NR_64_rt_sigreturn, stub_rt_sigreturn)
+
+#define __NR_64_ioctl				16
+__SYSCALL(__NR_64_ioctl, sys_ioctl)
+#define __NR_pread64				__NR_COMMON_SYSCALL(17)
 __SYSCALL(__NR_pread64, sys_pread64)
-#define __NR_pwrite64				18
+#define __NR_pwrite64				__NR_COMMON_SYSCALL(18)
 __SYSCALL(__NR_pwrite64, sys_pwrite64)
-#define __NR_readv				19
-__SYSCALL(__NR_readv, sys_readv)
-#define __NR_writev				20
-__SYSCALL(__NR_writev, sys_writev)
-#define __NR_access				21
+#define __NR_64_readv				19
+__SYSCALL(__NR_64_readv, sys_readv)
+#define __NR_64_writev				20
+__SYSCALL(__NR_64_writev, sys_writev)
+#define __NR_access				__NR_COMMON_SYSCALL(21)
 __SYSCALL(__NR_access, sys_access)
-#define __NR_pipe				22
+#define __NR_pipe				__NR_COMMON_SYSCALL(22)
 __SYSCALL(__NR_pipe, sys_pipe)
-#define __NR_select				23
+#define __NR_select				__NR_COMMON_SYSCALL(23)
 __SYSCALL(__NR_select, sys_select)
 
-#define __NR_sched_yield			24
+#define __NR_sched_yield			__NR_COMMON_SYSCALL(24)
 __SYSCALL(__NR_sched_yield, sys_sched_yield)
-#define __NR_mremap				25
+#define __NR_mremap				__NR_COMMON_SYSCALL(25)
 __SYSCALL(__NR_mremap, sys_mremap)
-#define __NR_msync				26
+#define __NR_msync				__NR_COMMON_SYSCALL(26)
 __SYSCALL(__NR_msync, sys_msync)
-#define __NR_mincore				27
+#define __NR_mincore				__NR_COMMON_SYSCALL(27)
 __SYSCALL(__NR_mincore, sys_mincore)
-#define __NR_madvise				28
+#define __NR_madvise				__NR_COMMON_SYSCALL(28)
 __SYSCALL(__NR_madvise, sys_madvise)
-#define __NR_shmget				29
+#define __NR_shmget				__NR_COMMON_SYSCALL(29)
 __SYSCALL(__NR_shmget, sys_shmget)
-#define __NR_shmat				30
+#define __NR_shmat				__NR_COMMON_SYSCALL(30)
 __SYSCALL(__NR_shmat, sys_shmat)
-#define __NR_shmctl				31
+#define __NR_shmctl				__NR_COMMON_SYSCALL(31)
 __SYSCALL(__NR_shmctl, sys_shmctl)
 
-#define __NR_dup				32
+#define __NR_dup				__NR_COMMON_SYSCALL(32)
 __SYSCALL(__NR_dup, sys_dup)
-#define __NR_dup2				33
+#define __NR_dup2				__NR_COMMON_SYSCALL(33)
 __SYSCALL(__NR_dup2, sys_dup2)
-#define __NR_pause				34
+#define __NR_pause				__NR_COMMON_SYSCALL(34)
 __SYSCALL(__NR_pause, sys_pause)
-#define __NR_nanosleep				35
+#define __NR_nanosleep				__NR_COMMON_SYSCALL(35)
 __SYSCALL(__NR_nanosleep, sys_nanosleep)
-#define __NR_getitimer				36
+#define __NR_getitimer				__NR_COMMON_SYSCALL(36)
 __SYSCALL(__NR_getitimer, sys_getitimer)
-#define __NR_alarm				37
+#define __NR_alarm				__NR_COMMON_SYSCALL(37)
 __SYSCALL(__NR_alarm, sys_alarm)
-#define __NR_setitimer				38
+#define __NR_setitimer				__NR_COMMON_SYSCALL(38)
 __SYSCALL(__NR_setitimer, sys_setitimer)
-#define __NR_getpid				39
+#define __NR_getpid				__NR_COMMON_SYSCALL(39)
 __SYSCALL(__NR_getpid, sys_getpid)
 
-#define __NR_sendfile				40
+#define __NR_sendfile				__NR_COMMON_SYSCALL(40)
 __SYSCALL(__NR_sendfile, sys_sendfile64)
-#define __NR_socket				41
+#define __NR_socket				__NR_COMMON_SYSCALL(41)
 __SYSCALL(__NR_socket, sys_socket)
-#define __NR_connect				42
+#define __NR_connect				__NR_COMMON_SYSCALL(42)
 __SYSCALL(__NR_connect, sys_connect)
-#define __NR_accept				43
+#define __NR_accept				__NR_COMMON_SYSCALL(43)
 __SYSCALL(__NR_accept, sys_accept)
-#define __NR_sendto				44
+#define __NR_sendto				__NR_COMMON_SYSCALL(44)
 __SYSCALL(__NR_sendto, sys_sendto)
-#define __NR_recvfrom				45
-__SYSCALL(__NR_recvfrom, sys_recvfrom)
-#define __NR_sendmsg				46
-__SYSCALL(__NR_sendmsg, sys_sendmsg)
-#define __NR_recvmsg				47
-__SYSCALL(__NR_recvmsg, sys_recvmsg)
-
-#define __NR_shutdown				48
+#define __NR_64_recvfrom			45
+__SYSCALL(__NR_64_recvfrom, sys_recvfrom)
+#define __NR_64_sendmsg				46
+__SYSCALL(__NR_64_sendmsg, sys_sendmsg)
+#define __NR_64_recvmsg				47
+__SYSCALL(__NR_64_recvmsg, sys_recvmsg)
+
+#define __NR_shutdown				__NR_COMMON_SYSCALL(48)
 __SYSCALL(__NR_shutdown, sys_shutdown)
-#define __NR_bind				49
+#define __NR_bind				__NR_COMMON_SYSCALL(49)
 __SYSCALL(__NR_bind, sys_bind)
-#define __NR_listen				50
+#define __NR_listen				__NR_COMMON_SYSCALL(50)
 __SYSCALL(__NR_listen, sys_listen)
-#define __NR_getsockname			51
+#define __NR_getsockname			__NR_COMMON_SYSCALL(51)
 __SYSCALL(__NR_getsockname, sys_getsockname)
-#define __NR_getpeername			52
+#define __NR_getpeername			__NR_COMMON_SYSCALL(52)
 __SYSCALL(__NR_getpeername, sys_getpeername)
-#define __NR_socketpair				53
+#define __NR_socketpair				__NR_COMMON_SYSCALL(53)
 __SYSCALL(__NR_socketpair, sys_socketpair)
-#define __NR_setsockopt				54
+#define __NR_setsockopt				__NR_COMMON_SYSCALL(54)
 __SYSCALL(__NR_setsockopt, sys_setsockopt)
-#define __NR_getsockopt				55
+#define __NR_getsockopt				__NR_COMMON_SYSCALL(55)
 __SYSCALL(__NR_getsockopt, sys_getsockopt)
 
-#define __NR_clone				56
+#define __NR_clone				__NR_COMMON_SYSCALL(56)
 __SYSCALL(__NR_clone, stub_clone)
-#define __NR_fork				57
+#define __NR_fork				__NR_COMMON_SYSCALL(57)
 __SYSCALL(__NR_fork, stub_fork)
-#define __NR_vfork				58
+#define __NR_vfork				__NR_COMMON_SYSCALL(58)
 __SYSCALL(__NR_vfork, stub_vfork)
-#define __NR_execve				59
-__SYSCALL(__NR_execve, stub_execve)
-#define __NR_exit				60
+#define __NR_64_execve				59
+__SYSCALL(__NR_64_execve, stub_execve)
+#define __NR_exit				__NR_COMMON_SYSCALL(60)
 __SYSCALL(__NR_exit, sys_exit)
-#define __NR_wait4				61
+#define __NR_wait4				__NR_COMMON_SYSCALL(61)
 __SYSCALL(__NR_wait4, sys_wait4)
-#define __NR_kill				62
+#define __NR_kill				__NR_COMMON_SYSCALL(62)
 __SYSCALL(__NR_kill, sys_kill)
-#define __NR_uname				63
+#define __NR_uname				__NR_COMMON_SYSCALL(63)
 __SYSCALL(__NR_uname, sys_newuname)
 
-#define __NR_semget				64
+#define __NR_semget				__NR_COMMON_SYSCALL(64)
 __SYSCALL(__NR_semget, sys_semget)
-#define __NR_semop				65
+#define __NR_semop				__NR_COMMON_SYSCALL(65)
 __SYSCALL(__NR_semop, sys_semop)
-#define __NR_semctl				66
+#define __NR_semctl				__NR_COMMON_SYSCALL(66)
 __SYSCALL(__NR_semctl, sys_semctl)
-#define __NR_shmdt				67
+#define __NR_shmdt				__NR_COMMON_SYSCALL(67)
 __SYSCALL(__NR_shmdt, sys_shmdt)
-#define __NR_msgget				68
+#define __NR_msgget				__NR_COMMON_SYSCALL(68)
 __SYSCALL(__NR_msgget, sys_msgget)
-#define __NR_msgsnd				69
+#define __NR_msgsnd				__NR_COMMON_SYSCALL(69)
 __SYSCALL(__NR_msgsnd, sys_msgsnd)
-#define __NR_msgrcv				70
+#define __NR_msgrcv				__NR_COMMON_SYSCALL(70)
 __SYSCALL(__NR_msgrcv, sys_msgrcv)
-#define __NR_msgctl				71
+#define __NR_msgctl				__NR_COMMON_SYSCALL(71)
 __SYSCALL(__NR_msgctl, sys_msgctl)
 
-#define __NR_fcntl				72
+#define __NR_fcntl				__NR_COMMON_SYSCALL(72)
 __SYSCALL(__NR_fcntl, sys_fcntl)
-#define __NR_flock				73
+#define __NR_flock				__NR_COMMON_SYSCALL(73)
 __SYSCALL(__NR_flock, sys_flock)
-#define __NR_fsync				74
+#define __NR_fsync				__NR_COMMON_SYSCALL(74)
 __SYSCALL(__NR_fsync, sys_fsync)
-#define __NR_fdatasync				75
+#define __NR_fdatasync				__NR_COMMON_SYSCALL(75)
 __SYSCALL(__NR_fdatasync, sys_fdatasync)
-#define __NR_truncate				76
+#define __NR_truncate				__NR_COMMON_SYSCALL(76)
 __SYSCALL(__NR_truncate, sys_truncate)
-#define __NR_ftruncate				77
+#define __NR_ftruncate				__NR_COMMON_SYSCALL(77)
 __SYSCALL(__NR_ftruncate, sys_ftruncate)
-#define __NR_getdents				78
-__SYSCALL(__NR_getdents, sys_getdents)
-#define __NR_getcwd				79
+#define __NR_64_getdents			78
+__SYSCALL(__NR_64_getdents, sys_getdents)
+#define __NR_getcwd				__NR_COMMON_SYSCALL(79)
 __SYSCALL(__NR_getcwd, sys_getcwd)
 
-#define __NR_chdir				80
+#define __NR_chdir				__NR_COMMON_SYSCALL(80)
 __SYSCALL(__NR_chdir, sys_chdir)
-#define __NR_fchdir				81
+#define __NR_fchdir				__NR_COMMON_SYSCALL(81)
 __SYSCALL(__NR_fchdir, sys_fchdir)
-#define __NR_rename				82
+#define __NR_rename				__NR_COMMON_SYSCALL(82)
 __SYSCALL(__NR_rename, sys_rename)
-#define __NR_mkdir				83
+#define __NR_mkdir				__NR_COMMON_SYSCALL(83)
 __SYSCALL(__NR_mkdir, sys_mkdir)
-#define __NR_rmdir				84
+#define __NR_rmdir				__NR_COMMON_SYSCALL(84)
 __SYSCALL(__NR_rmdir, sys_rmdir)
-#define __NR_creat				85
+#define __NR_creat				__NR_COMMON_SYSCALL(85)
 __SYSCALL(__NR_creat, sys_creat)
-#define __NR_link				86
+#define __NR_link				__NR_COMMON_SYSCALL(86)
 __SYSCALL(__NR_link, sys_link)
-#define __NR_unlink				87
+#define __NR_unlink				__NR_COMMON_SYSCALL(87)
 __SYSCALL(__NR_unlink, sys_unlink)
 
-#define __NR_symlink				88
+#define __NR_symlink				__NR_COMMON_SYSCALL(88)
 __SYSCALL(__NR_symlink, sys_symlink)
-#define __NR_readlink				89
+#define __NR_readlink				__NR_COMMON_SYSCALL(89)
 __SYSCALL(__NR_readlink, sys_readlink)
-#define __NR_chmod				90
+#define __NR_chmod				__NR_COMMON_SYSCALL(90)
 __SYSCALL(__NR_chmod, sys_chmod)
-#define __NR_fchmod				91
+#define __NR_fchmod				__NR_COMMON_SYSCALL(91)
 __SYSCALL(__NR_fchmod, sys_fchmod)
-#define __NR_chown				92
+#define __NR_chown				__NR_COMMON_SYSCALL(92)
 __SYSCALL(__NR_chown, sys_chown)
-#define __NR_fchown				93
+#define __NR_fchown				__NR_COMMON_SYSCALL(93)
 __SYSCALL(__NR_fchown, sys_fchown)
-#define __NR_lchown				94
+#define __NR_lchown				__NR_COMMON_SYSCALL(94)
 __SYSCALL(__NR_lchown, sys_lchown)
-#define __NR_umask				95
+#define __NR_umask				__NR_COMMON_SYSCALL(95)
 __SYSCALL(__NR_umask, sys_umask)
 
-#define __NR_gettimeofday			96
+#define __NR_gettimeofday			__NR_COMMON_SYSCALL(96)
 __SYSCALL(__NR_gettimeofday, sys_gettimeofday)
-#define __NR_getrlimit				97
+#define __NR_getrlimit				__NR_COMMON_SYSCALL(97)
 __SYSCALL(__NR_getrlimit, sys_getrlimit)
-#define __NR_getrusage				98
+#define __NR_getrusage				__NR_COMMON_SYSCALL(98)
 __SYSCALL(__NR_getrusage, sys_getrusage)
-#define __NR_sysinfo				99
+#define __NR_sysinfo				__NR_COMMON_SYSCALL(99)
 __SYSCALL(__NR_sysinfo, sys_sysinfo)
-#define __NR_times				100
-__SYSCALL(__NR_times, sys_times)
-#define __NR_ptrace				101
+#define __NR_64_times				100
+__SYSCALL(__NR_64_times, sys_times)
+#define __NR_ptrace				__NR_COMMON_SYSCALL(101)
 __SYSCALL(__NR_ptrace, sys_ptrace)
-#define __NR_getuid				102
+#define __NR_getuid				__NR_COMMON_SYSCALL(102)
 __SYSCALL(__NR_getuid, sys_getuid)
-#define __NR_syslog				103
+#define __NR_syslog				__NR_COMMON_SYSCALL(103)
 __SYSCALL(__NR_syslog, sys_syslog)
 
 /* at the very end the stuff that never runs during the benchmarks */
-#define __NR_getgid				104
+#define __NR_getgid				__NR_COMMON_SYSCALL(104)
 __SYSCALL(__NR_getgid, sys_getgid)
-#define __NR_setuid				105
+#define __NR_setuid				__NR_COMMON_SYSCALL(105)
 __SYSCALL(__NR_setuid, sys_setuid)
-#define __NR_setgid				106
+#define __NR_setgid				__NR_COMMON_SYSCALL(106)
 __SYSCALL(__NR_setgid, sys_setgid)
-#define __NR_geteuid				107
+#define __NR_geteuid				__NR_COMMON_SYSCALL(107)
 __SYSCALL(__NR_geteuid, sys_geteuid)
-#define __NR_getegid				108
+#define __NR_getegid				__NR_COMMON_SYSCALL(108)
 __SYSCALL(__NR_getegid, sys_getegid)
-#define __NR_setpgid				109
+#define __NR_setpgid				__NR_COMMON_SYSCALL(109)
 __SYSCALL(__NR_setpgid, sys_setpgid)
-#define __NR_getppid				110
+#define __NR_getppid				__NR_COMMON_SYSCALL(110)
 __SYSCALL(__NR_getppid, sys_getppid)
-#define __NR_getpgrp				111
+#define __NR_getpgrp				__NR_COMMON_SYSCALL(111)
 __SYSCALL(__NR_getpgrp, sys_getpgrp)
 
-#define __NR_setsid				112
+#define __NR_setsid				__NR_COMMON_SYSCALL(112)
 __SYSCALL(__NR_setsid, sys_setsid)
-#define __NR_setreuid				113
+#define __NR_setreuid				__NR_COMMON_SYSCALL(113)
 __SYSCALL(__NR_setreuid, sys_setreuid)
-#define __NR_setregid				114
+#define __NR_setregid				__NR_COMMON_SYSCALL(114)
 __SYSCALL(__NR_setregid, sys_setregid)
-#define __NR_getgroups				115
+#define __NR_getgroups				__NR_COMMON_SYSCALL(115)
 __SYSCALL(__NR_getgroups, sys_getgroups)
-#define __NR_setgroups				116
+#define __NR_setgroups				__NR_COMMON_SYSCALL(116)
 __SYSCALL(__NR_setgroups, sys_setgroups)
-#define __NR_setresuid				117
+#define __NR_setresuid				__NR_COMMON_SYSCALL(117)
 __SYSCALL(__NR_setresuid, sys_setresuid)
-#define __NR_getresuid				118
+#define __NR_getresuid				__NR_COMMON_SYSCALL(118)
 __SYSCALL(__NR_getresuid, sys_getresuid)
-#define __NR_setresgid				119
+#define __NR_setresgid				__NR_COMMON_SYSCALL(119)
 __SYSCALL(__NR_setresgid, sys_setresgid)
 
-#define __NR_getresgid				120
+#define __NR_getresgid				__NR_COMMON_SYSCALL(120)
 __SYSCALL(__NR_getresgid, sys_getresgid)
-#define __NR_getpgid				121
+#define __NR_getpgid				__NR_COMMON_SYSCALL(121)
 __SYSCALL(__NR_getpgid, sys_getpgid)
-#define __NR_setfsuid				122
+#define __NR_setfsuid				__NR_COMMON_SYSCALL(122)
 __SYSCALL(__NR_setfsuid, sys_setfsuid)
-#define __NR_setfsgid				123
+#define __NR_setfsgid				__NR_COMMON_SYSCALL(123)
 __SYSCALL(__NR_setfsgid, sys_setfsgid)
-#define __NR_getsid				124
+#define __NR_getsid				__NR_COMMON_SYSCALL(124)
 __SYSCALL(__NR_getsid, sys_getsid)
-#define __NR_capget				125
+#define __NR_capget				__NR_COMMON_SYSCALL(125)
 __SYSCALL(__NR_capget, sys_capget)
-#define __NR_capset				126
+#define __NR_capset				__NR_COMMON_SYSCALL(126)
 __SYSCALL(__NR_capset, sys_capset)
 
-#define __NR_rt_sigpending			127
-__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
-#define __NR_rt_sigtimedwait			128
-__SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait)
-#define __NR_rt_sigqueueinfo			129
-__SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo)
-#define __NR_rt_sigsuspend			130
+#define __NR_64_rt_sigpending			127
+__SYSCALL(__NR_64_rt_sigpending, sys_rt_sigpending)
+#define __NR_64_rt_sigtimedwait			128
+__SYSCALL(__NR_64_rt_sigtimedwait, sys_rt_sigtimedwait)
+#define __NR_64_rt_sigqueueinfo			129
+__SYSCALL(__NR_64_rt_sigqueueinfo, sys_rt_sigqueueinfo)
+#define __NR_rt_sigsuspend			__NR_COMMON_SYSCALL(130)
 __SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend)
-#define __NR_sigaltstack			131
-__SYSCALL(__NR_sigaltstack, stub_sigaltstack)
-#define __NR_utime				132
+#define __NR_64_sigaltstack			131
+__SYSCALL(__NR_64_sigaltstack, stub_sigaltstack)
+#define __NR_utime				__NR_COMMON_SYSCALL(132)
 __SYSCALL(__NR_utime, sys_utime)
-#define __NR_mknod				133
+#define __NR_mknod				__NR_COMMON_SYSCALL(133)
 __SYSCALL(__NR_mknod, sys_mknod)
 
 /* Only needed for a.out */
-#define __NR_uselib				134
-__SYSCALL(__NR_uselib, sys_ni_syscall)
-#define __NR_personality			135
+#define __NR_64_uselib				134
+__SYSCALL(__NR_64_uselib, sys_ni_syscall)
+#define __NR_personality			__NR_COMMON_SYSCALL(135)
 __SYSCALL(__NR_personality, sys_personality)
 
-#define __NR_ustat				136
+#define __NR_ustat				__NR_COMMON_SYSCALL(136)
 __SYSCALL(__NR_ustat, sys_ustat)
-#define __NR_statfs				137
+#define __NR_statfs				__NR_COMMON_SYSCALL(137)
 __SYSCALL(__NR_statfs, sys_statfs)
-#define __NR_fstatfs				138
+#define __NR_fstatfs				__NR_COMMON_SYSCALL(138)
 __SYSCALL(__NR_fstatfs, sys_fstatfs)
-#define __NR_sysfs				139
+#define __NR_sysfs				__NR_COMMON_SYSCALL(139)
 __SYSCALL(__NR_sysfs, sys_sysfs)
 
-#define __NR_getpriority			140
+#define __NR_getpriority			__NR_COMMON_SYSCALL(140)
 __SYSCALL(__NR_getpriority, sys_getpriority)
-#define __NR_setpriority			141
+#define __NR_setpriority			__NR_COMMON_SYSCALL(141)
 __SYSCALL(__NR_setpriority, sys_setpriority)
-#define __NR_sched_setparam			142
+#define __NR_sched_setparam			__NR_COMMON_SYSCALL(142)
 __SYSCALL(__NR_sched_setparam, sys_sched_setparam)
-#define __NR_sched_getparam			143
+#define __NR_sched_getparam			__NR_COMMON_SYSCALL(143)
 __SYSCALL(__NR_sched_getparam, sys_sched_getparam)
-#define __NR_sched_setscheduler			144
+#define __NR_sched_setscheduler			__NR_COMMON_SYSCALL(144)
 __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
-#define __NR_sched_getscheduler			145
+#define __NR_sched_getscheduler			__NR_COMMON_SYSCALL(145)
 __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
-#define __NR_sched_get_priority_max		146
+#define __NR_sched_get_priority_max		__NR_COMMON_SYSCALL(146)
 __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
-#define __NR_sched_get_priority_min		147
+#define __NR_sched_get_priority_min		__NR_COMMON_SYSCALL(147)
 __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
-#define __NR_sched_rr_get_interval		148
+#define __NR_sched_rr_get_interval		__NR_COMMON_SYSCALL(148)
 __SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval)
 
-#define __NR_mlock				149
+#define __NR_mlock				__NR_COMMON_SYSCALL(149)
 __SYSCALL(__NR_mlock, sys_mlock)
-#define __NR_munlock				150
+#define __NR_munlock				__NR_COMMON_SYSCALL(150)
 __SYSCALL(__NR_munlock, sys_munlock)
-#define __NR_mlockall				151
+#define __NR_mlockall				__NR_COMMON_SYSCALL(151)
 __SYSCALL(__NR_mlockall, sys_mlockall)
-#define __NR_munlockall				152
+#define __NR_munlockall				__NR_COMMON_SYSCALL(152)
 __SYSCALL(__NR_munlockall, sys_munlockall)
 
-#define __NR_vhangup				153
+#define __NR_vhangup				__NR_COMMON_SYSCALL(153)
 __SYSCALL(__NR_vhangup, sys_vhangup)
 
-#define __NR_modify_ldt				154
+#define __NR_modify_ldt				__NR_COMMON_SYSCALL(154)
 __SYSCALL(__NR_modify_ldt, sys_modify_ldt)
 
-#define __NR_pivot_root				155
+#define __NR_pivot_root				__NR_COMMON_SYSCALL(155)
 __SYSCALL(__NR_pivot_root, sys_pivot_root)
 
-#define __NR__sysctl				156
-__SYSCALL(__NR__sysctl, sys_sysctl)
+#define __NR_64__sysctl				156
+__SYSCALL(__NR_64__sysctl, sys_sysctl)
 
-#define __NR_prctl				157
+#define __NR_prctl				__NR_COMMON_SYSCALL(157)
 __SYSCALL(__NR_prctl, sys_prctl)
-#define __NR_arch_prctl				158
+#define __NR_arch_prctl				__NR_COMMON_SYSCALL(158)
 __SYSCALL(__NR_arch_prctl, sys_arch_prctl)
 
-#define __NR_adjtimex				159
+#define __NR_adjtimex				__NR_COMMON_SYSCALL(159)
 __SYSCALL(__NR_adjtimex, sys_adjtimex)
 
-#define __NR_setrlimit				160
+#define __NR_setrlimit				__NR_COMMON_SYSCALL(160)
 __SYSCALL(__NR_setrlimit, sys_setrlimit)
 
-#define __NR_chroot				161
+#define __NR_chroot				__NR_COMMON_SYSCALL(161)
 __SYSCALL(__NR_chroot, sys_chroot)
 
-#define __NR_sync				162
+#define __NR_sync				__NR_COMMON_SYSCALL(162)
 __SYSCALL(__NR_sync, sys_sync)
 
-#define __NR_acct				163
+#define __NR_acct				__NR_COMMON_SYSCALL(163)
 __SYSCALL(__NR_acct, sys_acct)
 
-#define __NR_settimeofday			164
+#define __NR_settimeofday			__NR_COMMON_SYSCALL(164)
 __SYSCALL(__NR_settimeofday, sys_settimeofday)
 
-#define __NR_mount				165
+#define __NR_mount				__NR_COMMON_SYSCALL(165)
 __SYSCALL(__NR_mount, sys_mount)
-#define __NR_umount2				166
+#define __NR_umount2				__NR_COMMON_SYSCALL(166)
 __SYSCALL(__NR_umount2, sys_umount)
 
-#define __NR_swapon				167
+#define __NR_swapon				__NR_COMMON_SYSCALL(167)
 __SYSCALL(__NR_swapon, sys_swapon)
-#define __NR_swapoff				168
+#define __NR_swapoff				__NR_COMMON_SYSCALL(168)
 __SYSCALL(__NR_swapoff, sys_swapoff)
 
-#define __NR_reboot				169
+#define __NR_reboot				__NR_COMMON_SYSCALL(169)
 __SYSCALL(__NR_reboot, sys_reboot)
 
-#define __NR_sethostname			170
+#define __NR_sethostname			__NR_COMMON_SYSCALL(170)
 __SYSCALL(__NR_sethostname, sys_sethostname)
-#define __NR_setdomainname			171
+#define __NR_setdomainname			__NR_COMMON_SYSCALL(171)
 __SYSCALL(__NR_setdomainname, sys_setdomainname)
 
-#define __NR_iopl				172
+#define __NR_iopl				__NR_COMMON_SYSCALL(172)
 __SYSCALL(__NR_iopl, stub_iopl)
-#define __NR_ioperm				173
+#define __NR_ioperm				__NR_COMMON_SYSCALL(173)
 __SYSCALL(__NR_ioperm, sys_ioperm)
 
-#define __NR_create_module			174
-__SYSCALL(__NR_create_module, sys_ni_syscall)
-#define __NR_init_module			175
+#define __NR_64_create_module			174
+__SYSCALL(__NR_64_create_module, sys_ni_syscall)
+#define __NR_init_module			__NR_COMMON_SYSCALL(175)
 __SYSCALL(__NR_init_module, sys_init_module)
-#define __NR_delete_module			176
+#define __NR_delete_module			__NR_COMMON_SYSCALL(176)
 __SYSCALL(__NR_delete_module, sys_delete_module)
-#define __NR_get_kernel_syms			177
-__SYSCALL(__NR_get_kernel_syms, sys_ni_syscall)
-#define __NR_query_module			178
-__SYSCALL(__NR_query_module, sys_ni_syscall)
+#define __NR_64_get_kernel_syms			177
+__SYSCALL(__NR_64_get_kernel_syms, sys_ni_syscall)
+#define __NR_64_query_module			178
+__SYSCALL(__NR_64_query_module, sys_ni_syscall)
 
-#define __NR_quotactl				179
+#define __NR_quotactl				__NR_COMMON_SYSCALL(179)
 __SYSCALL(__NR_quotactl, sys_quotactl)
 
-#define __NR_nfsservctl				180
-__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
+#define __NR_64_nfsservctl			180
+__SYSCALL(__NR_64_nfsservctl, sys_ni_syscall)
 
 /* reserved for LiS/STREAMS */
-#define __NR_getpmsg				181
+#define __NR_getpmsg				__NR_COMMON_SYSCALL(181)
 __SYSCALL(__NR_getpmsg, sys_ni_syscall)
-#define __NR_putpmsg				182
+#define __NR_putpmsg				__NR_COMMON_SYSCALL(182)
 __SYSCALL(__NR_putpmsg, sys_ni_syscall)
 
 /* reserved for AFS */
-#define __NR_afs_syscall			183
+#define __NR_afs_syscall			__NR_COMMON_SYSCALL(183)
 __SYSCALL(__NR_afs_syscall, sys_ni_syscall)
 
 /* reserved for tux */
-#define __NR_tuxcall				184
+#define __NR_tuxcall				__NR_COMMON_SYSCALL(184)
 __SYSCALL(__NR_tuxcall, sys_ni_syscall)
 
-#define __NR_security				185
+#define __NR_security				__NR_COMMON_SYSCALL(185)
 __SYSCALL(__NR_security, sys_ni_syscall)
 
-#define __NR_gettid				186
+#define __NR_gettid				__NR_COMMON_SYSCALL(186)
 __SYSCALL(__NR_gettid, sys_gettid)
 
-#define __NR_readahead				187
+#define __NR_readahead				__NR_COMMON_SYSCALL(187)
 __SYSCALL(__NR_readahead, sys_readahead)
-#define __NR_setxattr				188
+#define __NR_setxattr				__NR_COMMON_SYSCALL(188)
 __SYSCALL(__NR_setxattr, sys_setxattr)
-#define __NR_lsetxattr				189
+#define __NR_lsetxattr				__NR_COMMON_SYSCALL(189)
 __SYSCALL(__NR_lsetxattr, sys_lsetxattr)
-#define __NR_fsetxattr				190
+#define __NR_fsetxattr				__NR_COMMON_SYSCALL(190)
 __SYSCALL(__NR_fsetxattr, sys_fsetxattr)
-#define __NR_getxattr				191
+#define __NR_getxattr				__NR_COMMON_SYSCALL(191)
 __SYSCALL(__NR_getxattr, sys_getxattr)
-#define __NR_lgetxattr				192
+#define __NR_lgetxattr				__NR_COMMON_SYSCALL(192)
 __SYSCALL(__NR_lgetxattr, sys_lgetxattr)
-#define __NR_fgetxattr				193
+#define __NR_fgetxattr				__NR_COMMON_SYSCALL(193)
 __SYSCALL(__NR_fgetxattr, sys_fgetxattr)
-#define __NR_listxattr				194
+#define __NR_listxattr				__NR_COMMON_SYSCALL(194)
 __SYSCALL(__NR_listxattr, sys_listxattr)
-#define __NR_llistxattr				195
+#define __NR_llistxattr				__NR_COMMON_SYSCALL(195)
 __SYSCALL(__NR_llistxattr, sys_llistxattr)
-#define __NR_flistxattr				196
+#define __NR_flistxattr				__NR_COMMON_SYSCALL(196)
 __SYSCALL(__NR_flistxattr, sys_flistxattr)
-#define __NR_removexattr			197
+#define __NR_removexattr			__NR_COMMON_SYSCALL(197)
 __SYSCALL(__NR_removexattr, sys_removexattr)
-#define __NR_lremovexattr			198
+#define __NR_lremovexattr			__NR_COMMON_SYSCALL(198)
 __SYSCALL(__NR_lremovexattr, sys_lremovexattr)
-#define __NR_fremovexattr			199
+#define __NR_fremovexattr			__NR_COMMON_SYSCALL(199)
 __SYSCALL(__NR_fremovexattr, sys_fremovexattr)
-#define __NR_tkill				200
+#define __NR_tkill				__NR_COMMON_SYSCALL(200)
 __SYSCALL(__NR_tkill, sys_tkill)
-#define __NR_time				201
+#define __NR_time				__NR_COMMON_SYSCALL(201)
 __SYSCALL(__NR_time, sys_time)
-#define __NR_futex				202
+#define __NR_futex				__NR_COMMON_SYSCALL(202)
 __SYSCALL(__NR_futex, sys_futex)
-#define __NR_sched_setaffinity			203
+#define __NR_sched_setaffinity			__NR_COMMON_SYSCALL(203)
 __SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity)
-#define __NR_sched_getaffinity			204
+#define __NR_sched_getaffinity			__NR_COMMON_SYSCALL(204)
 __SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity)
-#define __NR_set_thread_area			205
-__SYSCALL(__NR_set_thread_area, sys_ni_syscall)	/* use arch_prctl */
-#define __NR_io_setup				206
+#define __NR_64_set_thread_area			205
+__SYSCALL(__NR_64_set_thread_area, sys_ni_syscall)	/* use arch_prctl */
+#define __NR_io_setup				__NR_COMMON_SYSCALL(206)
 __SYSCALL(__NR_io_setup, sys_io_setup)
-#define __NR_io_destroy				207
+#define __NR_io_destroy				__NR_COMMON_SYSCALL(207)
 __SYSCALL(__NR_io_destroy, sys_io_destroy)
-#define __NR_io_getevents			208
+#define __NR_io_getevents			__NR_COMMON_SYSCALL(208)
 __SYSCALL(__NR_io_getevents, sys_io_getevents)
-#define __NR_io_submit				209
+#define __NR_io_submit				__NR_COMMON_SYSCALL(209)
 __SYSCALL(__NR_io_submit, sys_io_submit)
-#define __NR_io_cancel				210
+#define __NR_io_cancel				__NR_COMMON_SYSCALL(210)
 __SYSCALL(__NR_io_cancel, sys_io_cancel)
-#define __NR_get_thread_area			211
-__SYSCALL(__NR_get_thread_area, sys_ni_syscall)	/* use arch_prctl */
-#define __NR_lookup_dcookie			212
+#define __NR_64_get_thread_area			211
+__SYSCALL(__NR_64_get_thread_area, sys_ni_syscall)	/* use arch_prctl */
+#define __NR_lookup_dcookie			__NR_COMMON_SYSCALL(212)
 __SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie)
-#define __NR_epoll_create			213
+#define __NR_epoll_create			__NR_COMMON_SYSCALL(213)
 __SYSCALL(__NR_epoll_create, sys_epoll_create)
-#define __NR_epoll_ctl_old			214
-__SYSCALL(__NR_epoll_ctl_old, sys_ni_syscall)
-#define __NR_epoll_wait_old			215
-__SYSCALL(__NR_epoll_wait_old, sys_ni_syscall)
-#define __NR_remap_file_pages			216
+#define __NR_64_epoll_ctl_old			214
+__SYSCALL(__NR_64_epoll_ctl_old, sys_ni_syscall)
+#define __NR_64_epoll_wait_old			215
+__SYSCALL(__NR_64_epoll_wait_old, sys_ni_syscall)
+#define __NR_remap_file_pages			__NR_COMMON_SYSCALL(216)
 __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
-#define __NR_getdents64				217
+#define __NR_getdents64				__NR_COMMON_SYSCALL(217)
 __SYSCALL(__NR_getdents64, sys_getdents64)
-#define __NR_set_tid_address			218
+#define __NR_set_tid_address			__NR_COMMON_SYSCALL(218)
 __SYSCALL(__NR_set_tid_address, sys_set_tid_address)
-#define __NR_restart_syscall			219
+#define __NR_restart_syscall			__NR_COMMON_SYSCALL(219)
 __SYSCALL(__NR_restart_syscall, sys_restart_syscall)
-#define __NR_semtimedop				220
+#define __NR_semtimedop				__NR_COMMON_SYSCALL(220)
 __SYSCALL(__NR_semtimedop, sys_semtimedop)
-#define __NR_fadvise64				221
+#define __NR_fadvise64				__NR_COMMON_SYSCALL(221)
 __SYSCALL(__NR_fadvise64, sys_fadvise64)
-#define __NR_timer_create			222
-__SYSCALL(__NR_timer_create, sys_timer_create)
-#define __NR_timer_settime			223
+#define __NR_64_timer_create			222
+__SYSCALL(__NR_64_timer_create, sys_timer_create)
+#define __NR_timer_settime			__NR_COMMON_SYSCALL(223)
 __SYSCALL(__NR_timer_settime, sys_timer_settime)
-#define __NR_timer_gettime			224
+#define __NR_timer_gettime			__NR_COMMON_SYSCALL(224)
 __SYSCALL(__NR_timer_gettime, sys_timer_gettime)
-#define __NR_timer_getoverrun			225
+#define __NR_timer_getoverrun			__NR_COMMON_SYSCALL(225)
 __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
-#define __NR_timer_delete			226
+#define __NR_timer_delete			__NR_COMMON_SYSCALL(226)
 __SYSCALL(__NR_timer_delete, sys_timer_delete)
-#define __NR_clock_settime			227
+#define __NR_clock_settime			__NR_COMMON_SYSCALL(227)
 __SYSCALL(__NR_clock_settime, sys_clock_settime)
-#define __NR_clock_gettime			228
+#define __NR_clock_gettime			__NR_COMMON_SYSCALL(228)
 __SYSCALL(__NR_clock_gettime, sys_clock_gettime)
-#define __NR_clock_getres			229
+#define __NR_clock_getres			__NR_COMMON_SYSCALL(229)
 __SYSCALL(__NR_clock_getres, sys_clock_getres)
-#define __NR_clock_nanosleep			230
+#define __NR_clock_nanosleep			__NR_COMMON_SYSCALL(230)
 __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
-#define __NR_exit_group				231
+#define __NR_exit_group				__NR_COMMON_SYSCALL(231)
 __SYSCALL(__NR_exit_group, sys_exit_group)
-#define __NR_epoll_wait				232
+#define __NR_epoll_wait				__NR_COMMON_SYSCALL(232)
 __SYSCALL(__NR_epoll_wait, sys_epoll_wait)
-#define __NR_epoll_ctl				233
+#define __NR_epoll_ctl				__NR_COMMON_SYSCALL(233)
 __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
-#define __NR_tgkill				234
+#define __NR_tgkill				__NR_COMMON_SYSCALL(234)
 __SYSCALL(__NR_tgkill, sys_tgkill)
-#define __NR_utimes				235
+#define __NR_utimes				__NR_COMMON_SYSCALL(235)
 __SYSCALL(__NR_utimes, sys_utimes)
-#define __NR_vserver				236
-__SYSCALL(__NR_vserver, sys_ni_syscall)
-#define __NR_mbind				237
+#define __NR_64_vserver				236
+__SYSCALL(__NR_64_vserver, sys_ni_syscall)
+#define __NR_mbind				__NR_COMMON_SYSCALL(237)
 __SYSCALL(__NR_mbind, sys_mbind)
-#define __NR_set_mempolicy			238
+#define __NR_set_mempolicy			__NR_COMMON_SYSCALL(238)
 __SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
-#define __NR_get_mempolicy			239
+#define __NR_get_mempolicy			__NR_COMMON_SYSCALL(239)
 __SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
-#define __NR_mq_open				240
+#define __NR_mq_open				__NR_COMMON_SYSCALL(240)
 __SYSCALL(__NR_mq_open, sys_mq_open)
-#define __NR_mq_unlink				241
+#define __NR_mq_unlink				__NR_COMMON_SYSCALL(241)
 __SYSCALL(__NR_mq_unlink, sys_mq_unlink)
-#define __NR_mq_timedsend			242
+#define __NR_mq_timedsend			__NR_COMMON_SYSCALL(242)
 __SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
-#define __NR_mq_timedreceive			243
+#define __NR_mq_timedreceive			__NR_COMMON_SYSCALL(243)
 __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
-#define __NR_mq_notify				244
-__SYSCALL(__NR_mq_notify, sys_mq_notify)
-#define __NR_mq_getsetattr			245
+#define __NR_64_mq_notify			244
+__SYSCALL(__NR_64_mq_notify, sys_mq_notify)
+#define __NR_mq_getsetattr			__NR_COMMON_SYSCALL(245)
 __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
-#define __NR_kexec_load				246
-__SYSCALL(__NR_kexec_load, sys_kexec_load)
-#define __NR_waitid				247
-__SYSCALL(__NR_waitid, sys_waitid)
-#define __NR_add_key				248
+#define __NR_64_kexec_load			246
+__SYSCALL(__NR_64_kexec_load, sys_kexec_load)
+#define __NR_64_waitid				247
+__SYSCALL(__NR_64_waitid, sys_waitid)
+#define __NR_add_key				__NR_COMMON_SYSCALL(248)
 __SYSCALL(__NR_add_key, sys_add_key)
-#define __NR_request_key			249
+#define __NR_request_key			__NR_COMMON_SYSCALL(249)
 __SYSCALL(__NR_request_key, sys_request_key)
-#define __NR_keyctl				250
+#define __NR_keyctl				__NR_COMMON_SYSCALL(250)
 __SYSCALL(__NR_keyctl, sys_keyctl)
-#define __NR_ioprio_set				251
+#define __NR_ioprio_set				__NR_COMMON_SYSCALL(251)
 __SYSCALL(__NR_ioprio_set, sys_ioprio_set)
-#define __NR_ioprio_get				252
+#define __NR_ioprio_get				__NR_COMMON_SYSCALL(252)
 __SYSCALL(__NR_ioprio_get, sys_ioprio_get)
-#define __NR_inotify_init			253
+#define __NR_inotify_init			__NR_COMMON_SYSCALL(253)
 __SYSCALL(__NR_inotify_init, sys_inotify_init)
-#define __NR_inotify_add_watch			254
+#define __NR_inotify_add_watch			__NR_COMMON_SYSCALL(254)
 __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
-#define __NR_inotify_rm_watch			255
+#define __NR_inotify_rm_watch			__NR_COMMON_SYSCALL(255)
 __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
-#define __NR_migrate_pages			256
+#define __NR_migrate_pages			__NR_COMMON_SYSCALL(256)
 __SYSCALL(__NR_migrate_pages, sys_migrate_pages)
-#define __NR_openat				257
+#define __NR_openat				__NR_COMMON_SYSCALL(257)
 __SYSCALL(__NR_openat, sys_openat)
-#define __NR_mkdirat				258
+#define __NR_mkdirat				__NR_COMMON_SYSCALL(258)
 __SYSCALL(__NR_mkdirat, sys_mkdirat)
-#define __NR_mknodat				259
+#define __NR_mknodat				__NR_COMMON_SYSCALL(259)
 __SYSCALL(__NR_mknodat, sys_mknodat)
-#define __NR_fchownat				260
+#define __NR_fchownat				__NR_COMMON_SYSCALL(260)
 __SYSCALL(__NR_fchownat, sys_fchownat)
-#define __NR_futimesat				261
+#define __NR_futimesat				__NR_COMMON_SYSCALL(261)
 __SYSCALL(__NR_futimesat, sys_futimesat)
-#define __NR_newfstatat				262
+#define __NR_newfstatat				__NR_COMMON_SYSCALL(262)
 __SYSCALL(__NR_newfstatat, sys_newfstatat)
-#define __NR_unlinkat				263
+#define __NR_unlinkat				__NR_COMMON_SYSCALL(263)
 __SYSCALL(__NR_unlinkat, sys_unlinkat)
-#define __NR_renameat				264
+#define __NR_renameat				__NR_COMMON_SYSCALL(264)
 __SYSCALL(__NR_renameat, sys_renameat)
-#define __NR_linkat				265
+#define __NR_linkat				__NR_COMMON_SYSCALL(265)
 __SYSCALL(__NR_linkat, sys_linkat)
-#define __NR_symlinkat				266
+#define __NR_symlinkat				__NR_COMMON_SYSCALL(266)
 __SYSCALL(__NR_symlinkat, sys_symlinkat)
-#define __NR_readlinkat				267
+#define __NR_readlinkat				__NR_COMMON_SYSCALL(267)
 __SYSCALL(__NR_readlinkat, sys_readlinkat)
-#define __NR_fchmodat				268
+#define __NR_fchmodat				__NR_COMMON_SYSCALL(268)
 __SYSCALL(__NR_fchmodat, sys_fchmodat)
-#define __NR_faccessat				269
+#define __NR_faccessat				__NR_COMMON_SYSCALL(269)
 __SYSCALL(__NR_faccessat, sys_faccessat)
-#define __NR_pselect6				270
+#define __NR_pselect6				__NR_COMMON_SYSCALL(270)
 __SYSCALL(__NR_pselect6, sys_pselect6)
-#define __NR_ppoll				271
-__SYSCALL(__NR_ppoll,	sys_ppoll)
-#define __NR_unshare				272
+#define __NR_ppoll				__NR_COMMON_SYSCALL(271)
+__SYSCALL(__NR_ppoll, sys_ppoll)
+#define __NR_unshare				__NR_COMMON_SYSCALL(272)
 __SYSCALL(__NR_unshare,	sys_unshare)
-#define __NR_set_robust_list			273
-__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
-#define __NR_get_robust_list			274
-__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
-#define __NR_splice				275
+#define __NR_64_set_robust_list			273
+__SYSCALL(__NR_64_set_robust_list, sys_set_robust_list)
+#define __NR_64_get_robust_list			274
+__SYSCALL(__NR_64_get_robust_list, sys_get_robust_list)
+#define __NR_splice				__NR_COMMON_SYSCALL(275)
 __SYSCALL(__NR_splice, sys_splice)
-#define __NR_tee				276
+#define __NR_tee				__NR_COMMON_SYSCALL(276)
 __SYSCALL(__NR_tee, sys_tee)
-#define __NR_sync_file_range			277
+#define __NR_sync_file_range			__NR_COMMON_SYSCALL(277)
 __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
-#define __NR_vmsplice				278
-__SYSCALL(__NR_vmsplice, sys_vmsplice)
-#define __NR_move_pages				279
-__SYSCALL(__NR_move_pages, sys_move_pages)
-#define __NR_utimensat				280
+#define __NR_64_vmsplice			278
+__SYSCALL(__NR_64_vmsplice, sys_vmsplice)
+#define __NR_64_move_pages			279
+__SYSCALL(__NR_64_move_pages, sys_move_pages)
+#define __NR_utimensat				__NR_COMMON_SYSCALL(280)
 __SYSCALL(__NR_utimensat, sys_utimensat)
-#define __NR_epoll_pwait			281
+#define __NR_epoll_pwait			__NR_COMMON_SYSCALL(281)
 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
-#define __NR_signalfd				282
+#define __NR_signalfd				__NR_COMMON_SYSCALL(282)
 __SYSCALL(__NR_signalfd, sys_signalfd)
-#define __NR_timerfd_create			283
+#define __NR_timerfd_create			__NR_COMMON_SYSCALL(283)
 __SYSCALL(__NR_timerfd_create, sys_timerfd_create)
-#define __NR_eventfd				284
+#define __NR_eventfd				__NR_COMMON_SYSCALL(284)
 __SYSCALL(__NR_eventfd, sys_eventfd)
-#define __NR_fallocate				285
+#define __NR_fallocate				__NR_COMMON_SYSCALL(285)
 __SYSCALL(__NR_fallocate, sys_fallocate)
-#define __NR_timerfd_settime			286
+#define __NR_timerfd_settime			__NR_COMMON_SYSCALL(286)
 __SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
-#define __NR_timerfd_gettime			287
+#define __NR_timerfd_gettime			__NR_COMMON_SYSCALL(287)
 __SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
-#define __NR_accept4				288
+#define __NR_accept4				__NR_COMMON_SYSCALL(288)
 __SYSCALL(__NR_accept4, sys_accept4)
-#define __NR_signalfd4				289
+#define __NR_signalfd4				__NR_COMMON_SYSCALL(289)
 __SYSCALL(__NR_signalfd4, sys_signalfd4)
-#define __NR_eventfd2				290
+#define __NR_eventfd2				__NR_COMMON_SYSCALL(290)
 __SYSCALL(__NR_eventfd2, sys_eventfd2)
-#define __NR_epoll_create1			291
+#define __NR_epoll_create1			__NR_COMMON_SYSCALL(291)
 __SYSCALL(__NR_epoll_create1, sys_epoll_create1)
-#define __NR_dup3				292
+#define __NR_dup3				__NR_COMMON_SYSCALL(292)
 __SYSCALL(__NR_dup3, sys_dup3)
-#define __NR_pipe2				293
+#define __NR_pipe2				__NR_COMMON_SYSCALL(293)
 __SYSCALL(__NR_pipe2, sys_pipe2)
-#define __NR_inotify_init1			294
+#define __NR_inotify_init1			__NR_COMMON_SYSCALL(294)
 __SYSCALL(__NR_inotify_init1, sys_inotify_init1)
-#define __NR_preadv				295
-__SYSCALL(__NR_preadv, sys_preadv)
-#define __NR_pwritev				296
-__SYSCALL(__NR_pwritev, sys_pwritev)
-#define __NR_rt_tgsigqueueinfo			297
-__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
-#define __NR_perf_event_open			298
+#define __NR_64_preadv				295
+__SYSCALL(__NR_64_preadv, sys_preadv)
+#define __NR_64_pwritev				296
+__SYSCALL(__NR_64_pwritev, sys_pwritev)
+#define __NR_64_rt_tgsigqueueinfo		297
+__SYSCALL(__NR_64_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
+#define __NR_perf_event_open			__NR_COMMON_SYSCALL(298)
 __SYSCALL(__NR_perf_event_open, sys_perf_event_open)
-#define __NR_recvmmsg				299
-__SYSCALL(__NR_recvmmsg, sys_recvmmsg)
-#define __NR_fanotify_init			300
+#define __NR_64_recvmmsg			299
+__SYSCALL(__NR_64_recvmmsg, sys_recvmmsg)
+#define __NR_fanotify_init			__NR_COMMON_SYSCALL(300)
 __SYSCALL(__NR_fanotify_init, sys_fanotify_init)
-#define __NR_fanotify_mark			301
+#define __NR_fanotify_mark			__NR_COMMON_SYSCALL(301)
 __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
-#define __NR_prlimit64				302
+#define __NR_prlimit64				__NR_COMMON_SYSCALL(302)
 __SYSCALL(__NR_prlimit64, sys_prlimit64)
-#define __NR_name_to_handle_at			303
+#define __NR_name_to_handle_at			__NR_COMMON_SYSCALL(303)
 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
-#define __NR_open_by_handle_at			304
+#define __NR_open_by_handle_at			__NR_COMMON_SYSCALL(304)
 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
-#define __NR_clock_adjtime			305
+#define __NR_clock_adjtime			__NR_COMMON_SYSCALL(305)
 __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
-#define __NR_syncfs                             306
+#define __NR_syncfs                             __NR_COMMON_SYSCALL(306)
 __SYSCALL(__NR_syncfs, sys_syncfs)
-#define __NR_sendmmsg				307
-__SYSCALL(__NR_sendmmsg, sys_sendmmsg)
-#define __NR_setns				308
+#define __NR_64_sendmmsg			307
+__SYSCALL(__NR_64_sendmmsg, sys_sendmmsg)
+#define __NR_setns				__NR_COMMON_SYSCALL(308)
 __SYSCALL(__NR_setns, sys_setns)
-#define __NR_getcpu				309
+#define __NR_getcpu				__NR_COMMON_SYSCALL(309)
 __SYSCALL(__NR_getcpu, sys_getcpu)
-#define __NR_process_vm_readv			310
-__SYSCALL(__NR_process_vm_readv, sys_process_vm_readv)
-#define __NR_process_vm_writev			311
-__SYSCALL(__NR_process_vm_writev, sys_process_vm_writev)
+#define __NR_64_process_vm_readv		310
+__SYSCALL(__NR_64_process_vm_readv, sys_process_vm_readv)
+#define __NR_64_process_vm_writev		311
+__SYSCALL(__NR_64_process_vm_writev, sys_process_vm_writev)
+
+/* X32 support.  */
+#define __NR_x32_rt_sigaction			__NR_X32_SYSCALL(0)
+__X32_SYSCALL(__NR_x32_rt_sigaction, sys32_rt_sigaction)
+#define __NR_x32_rt_sigprocmask			__NR_X32_SYSCALL(1)
+__X32_SYSCALL(__NR_x32_rt_sigprocmask, sys32_rt_sigprocmask)
+#define __NR_x32_rt_sigreturn			__NR_X32_SYSCALL(2)
+__X32_SYSCALL(__NR_x32_rt_sigreturn, stub_x32_rt_sigreturn)
+#define __NR_x32_ioctl				__NR_X32_SYSCALL(3)
+__X32_SYSCALL(__NR_x32_ioctl, compat_sys_ioctl)
+#define __NR_x32_readv				__NR_X32_SYSCALL(4)
+__X32_SYSCALL(__NR_x32_readv, compat_sys_readv)
+#define __NR_x32_writev				__NR_X32_SYSCALL(5)
+__X32_SYSCALL(__NR_x32_writev, compat_sys_writev)
+#define __NR_x32_recvfrom			__NR_X32_SYSCALL(6)
+__X32_SYSCALL(__NR_x32_recvfrom, compat_sys_recvfrom)
+#define __NR_x32_sendmsg			__NR_X32_SYSCALL(7)
+__X32_SYSCALL(__NR_x32_sendmsg, compat_sys_sendmsg)
+
+#define __NR_x32_recvmsg			__NR_X32_SYSCALL(8)
+__X32_SYSCALL(__NR_x32_recvmsg, compat_sys_recvmsg)
+#define __NR_x32_execve				__NR_X32_SYSCALL(9)
+__X32_SYSCALL(__NR_x32_execve, stub_x32_execve)
+#define __NR_x32_times				__NR_X32_SYSCALL(10)
+__X32_SYSCALL(__NR_x32_times, compat_sys_times)
+#define __NR_x32_rt_sigpending			__NR_X32_SYSCALL(11)
+__X32_SYSCALL(__NR_x32_rt_sigpending, sys32_rt_sigpending)
+#define __NR_x32_rt_sigtimedwait		__NR_X32_SYSCALL(12)
+__X32_SYSCALL(__NR_x32_rt_sigtimedwait, compat_sys_rt_sigtimedwait)
+#define __NR_x32_rt_sigqueueinfo		__NR_X32_SYSCALL(13)
+__X32_SYSCALL(__NR_x32_rt_sigqueueinfo, sys32_rt_sigqueueinfo)
+#define __NR_x32_sigaltstack			__NR_X32_SYSCALL(14)
+__X32_SYSCALL(__NR_x32_sigaltstack, stub_x32_sigaltstack)
+#define __NR_x32_timer_create			__NR_X32_SYSCALL(15)
+__X32_SYSCALL(__NR_x32_timer_create, compat_sys_timer_create)
+
+#define __NR_x32_mq_notify			__NR_X32_SYSCALL(16)
+__X32_SYSCALL(__NR_x32_mq_notify, compat_sys_mq_notify)
+#define __NR_x32_kexec_load			__NR_X32_SYSCALL(17)
+__X32_SYSCALL(__NR_x32_kexec_load, compat_sys_kexec_load)
+#define __NR_x32_waitid				__NR_X32_SYSCALL(18)
+__X32_SYSCALL(__NR_x32_waitid, compat_sys_waitid)
+#define __NR_x32_set_robust_list		__NR_X32_SYSCALL(19)
+__X32_SYSCALL(__NR_x32_set_robust_list, compat_sys_set_robust_list)
+#define __NR_x32_get_robust_list		__NR_X32_SYSCALL(20)
+__X32_SYSCALL(__NR_x32_get_robust_list, compat_sys_get_robust_list)
+#define __NR_x32_vmsplice			__NR_X32_SYSCALL(21)
+__X32_SYSCALL(__NR_x32_vmsplice, compat_sys_vmsplice)
+#define __NR_x32_move_pages			__NR_X32_SYSCALL(22)
+__X32_SYSCALL(__NR_x32_move_pages, compat_sys_move_pages)
+#define __NR_x32_preadv				__NR_X32_SYSCALL(23)
+__SYSCALL(__NR_x32_preadv, compat_sys_preadv64)
+
+#define __NR_x32_pwritev			__NR_X32_SYSCALL(24)
+__SYSCALL(__NR_x32_pwritev, compat_sys_pwritev64)
+#define __NR_x32_rt_tgsigqueueinfo		__NR_X32_SYSCALL(25)
+__X32_SYSCALL(__NR_x32_rt_tgsigqueueinfo, compat_sys_rt_tgsigqueueinfo)
+#define __NR_x32_recvmmsg			__NR_X32_SYSCALL(26)
+__SYSCALL(__NR_x32_recvmmsg, compat_sys_recvmmsg)
+#define __NR_x32_sendmmsg			__NR_X32_SYSCALL(27)
+__SYSCALL(__NR_x32_sendmmsg, compat_sys_sendmmsg)
+#define __NR_x32_process_vm_readv		__NR_X32_SYSCALL(28)
+__SYSCALL(__NR_x32_process_vm_readv, compat_sys_process_vm_readv)
+#define __NR_x32_process_vm_writev		__NR_X32_SYSCALL(29)
+__SYSCALL(__NR_64_process_vm_writev, compat_sys_process_vm_writev)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
diff --git a/arch/x86/include/asm/unistd_64_compat.h b/arch/x86/include/asm/unistd_64_compat.h
new file mode 100644
index 0000000..0be9c1e
--- /dev/null
+++ b/arch/x86/include/asm/unistd_64_compat.h
@@ -0,0 +1,37 @@
+#ifndef _ASM_X86_UNISTD_64_COMPAT_H
+#define _ASM_X86_UNISTD_64_COMPAT_H
+
+#define __NR_rt_sigaction		__NR_64_rt_sigaction
+#define __NR_rt_sigprocmask		__NR_64_rt_sigprocmask
+#define __NR_rt_sigreturn		__NR_64_rt_sigreturn
+#define __NR_ioctl			__NR_64_ioctl
+#define __NR_readv			__NR_64_readv
+#define __NR_writev			__NR_64_writev
+#define __NR_recvfrom			__NR_64_recvfrom
+#define __NR_sendmsg			__NR_64_sendmsg
+#define __NR_recvmsg			__NR_64_recvmsg
+#define __NR_execve			__NR_64_execve
+#define __NR_times			__NR_64_times
+#define __NR_rt_sigpending		__NR_64_rt_sigpending
+#define __NR_rt_sigtimedwait		__NR_64_rt_sigtimedwait
+#define __NR_rt_sigqueueinfo		__NR_64_rt_sigqueueinfo
+#define __NR_sigaltstack		__NR_64_sigaltstack
+#define __NR__sysctl			__NR_64__sysctl
+#define __NR_nfsservctl			__NR_64_nfsservctl
+#define __NR_timer_create		__NR_64_timer_create
+#define __NR_mq_notify			__NR_64_mq_notify
+#define __NR_kexec_load			__NR_64_kexec_load
+#define __NR_waitid			__NR_64_waitid
+#define __NR_set_robust_list		__NR_64_set_robust_list
+#define __NR_get_robust_list		__NR_64_get_robust_list
+#define __NR_vmsplice			__NR_64_vmsplice
+#define __NR_move_pages			__NR_64_move_pages
+#define __NR_preadv			__NR_64_preadv
+#define __NR_pwritev			__NR_64_pwritev
+#define __NR_rt_tgsigqueueinfo		__NR_64_rt_tgsigqueueinfo
+#define __NR_recvmmsg			__NR_64_recvmmsg
+#define __NR_sendmmsg			__NR_64_sendmmsg
+#define __NR_process_vm_readv		__NR_64_process_vm_readv
+#define __NR_process_vm_writev		__NR_64_process_vm_writev
+
+#endif /* _ASM_X86_UNISTD_64_COMPAT_H */
diff --git a/arch/x86/include/asm/unistd_x32.h b/arch/x86/include/asm/unistd_x32.h
new file mode 100644
index 0000000..c79c8f6
--- /dev/null
+++ b/arch/x86/include/asm/unistd_x32.h
@@ -0,0 +1,734 @@
+#ifndef _ASM_X86_UNISTD_X32_H
+#define _ASM_X86_UNISTD_X32_H
+
+#ifndef __SYSCALL
+#define __SYSCALL(a, b)
+#endif
+
+#ifndef __X32_SYSCALL
+#define __X32_SYSCALL(a, b)
+#endif
+
+/* X32 system call mask.  */
+#define __X32_SYSCALL_BIT	0x40000000
+
+/* The first x32 system call.  */
+#define __X32_SYSCALL_BASE	512
+
+#ifdef __KERNEL__
+#define __NR_COMMON_SYSCALL(n)	(n)
+#define __NR_X32_SYSCALL(n)	(__X32_SYSCALL_BASE + n)
+#else
+#if __LP64__
+#define __NR_COMMON_SYSCALL(n)	(n)
+#else
+#define __NR_COMMON_SYSCALL(n)	(__X32_SYSCALL_BIT | (n))
+#endif
+#define __NR_X32_SYSCALL(n)	(__X32_SYSCALL_BIT | (__X32_SYSCALL_BASE + n))
+#endif
+
+/*
+ * This file contains the system call numbers.
+ *
+ * Note: holes are not allowed.
+ */
+
+/* at least 8 syscall per cacheline */
+#define __NR_read				__NR_COMMON_SYSCALL(0)
+__SYSCALL(__NR_read, sys_read)
+#define __NR_write				__NR_COMMON_SYSCALL(1)
+__SYSCALL(__NR_write, sys_write)
+#define __NR_open				__NR_COMMON_SYSCALL(2)
+__SYSCALL(__NR_open, sys_open)
+#define __NR_close				__NR_COMMON_SYSCALL(3)
+__SYSCALL(__NR_close, sys_close)
+#define __NR_stat				__NR_COMMON_SYSCALL(4)
+__SYSCALL(__NR_stat, sys_newstat)
+#define __NR_fstat				__NR_COMMON_SYSCALL(5)
+__SYSCALL(__NR_fstat, sys_newfstat)
+#define __NR_lstat				__NR_COMMON_SYSCALL(6)
+__SYSCALL(__NR_lstat, sys_newlstat)
+#define __NR_poll				__NR_COMMON_SYSCALL(7)
+__SYSCALL(__NR_poll, sys_poll)
+
+#define __NR_lseek				__NR_COMMON_SYSCALL(8)
+__SYSCALL(__NR_lseek, sys_lseek)
+#define __NR_mmap				__NR_COMMON_SYSCALL(9)
+__SYSCALL(__NR_mmap, sys_mmap)
+#define __NR_mprotect				__NR_COMMON_SYSCALL(10)
+__SYSCALL(__NR_mprotect, sys_mprotect)
+#define __NR_munmap				__NR_COMMON_SYSCALL(11)
+__SYSCALL(__NR_munmap, sys_munmap)
+#define __NR_brk				__NR_COMMON_SYSCALL(12)
+__SYSCALL(__NR_brk, sys_brk)
+
+#define __NR_pread64				__NR_COMMON_SYSCALL(17)
+__SYSCALL(__NR_pread64, sys_pread64)
+#define __NR_pwrite64				__NR_COMMON_SYSCALL(18)
+__SYSCALL(__NR_pwrite64, sys_pwrite64)
+#define __NR_access				__NR_COMMON_SYSCALL(21)
+__SYSCALL(__NR_access, sys_access)
+#define __NR_pipe				__NR_COMMON_SYSCALL(22)
+__SYSCALL(__NR_pipe, sys_pipe)
+#define __NR_select				__NR_COMMON_SYSCALL(23)
+__SYSCALL(__NR_select, sys_select)
+
+#define __NR_sched_yield			__NR_COMMON_SYSCALL(24)
+__SYSCALL(__NR_sched_yield, sys_sched_yield)
+#define __NR_mremap				__NR_COMMON_SYSCALL(25)
+__SYSCALL(__NR_mremap, sys_mremap)
+#define __NR_msync				__NR_COMMON_SYSCALL(26)
+__SYSCALL(__NR_msync, sys_msync)
+#define __NR_mincore				__NR_COMMON_SYSCALL(27)
+__SYSCALL(__NR_mincore, sys_mincore)
+#define __NR_madvise				__NR_COMMON_SYSCALL(28)
+__SYSCALL(__NR_madvise, sys_madvise)
+#define __NR_shmget				__NR_COMMON_SYSCALL(29)
+__SYSCALL(__NR_shmget, sys_shmget)
+#define __NR_shmat				__NR_COMMON_SYSCALL(30)
+__SYSCALL(__NR_shmat, sys_shmat)
+#define __NR_shmctl				__NR_COMMON_SYSCALL(31)
+__SYSCALL(__NR_shmctl, sys_shmctl)
+
+#define __NR_dup				__NR_COMMON_SYSCALL(32)
+__SYSCALL(__NR_dup, sys_dup)
+#define __NR_dup2				__NR_COMMON_SYSCALL(33)
+__SYSCALL(__NR_dup2, sys_dup2)
+#define __NR_pause				__NR_COMMON_SYSCALL(34)
+__SYSCALL(__NR_pause, sys_pause)
+#define __NR_nanosleep				__NR_COMMON_SYSCALL(35)
+__SYSCALL(__NR_nanosleep, sys_nanosleep)
+#define __NR_getitimer				__NR_COMMON_SYSCALL(36)
+__SYSCALL(__NR_getitimer, sys_getitimer)
+#define __NR_alarm				__NR_COMMON_SYSCALL(37)
+__SYSCALL(__NR_alarm, sys_alarm)
+#define __NR_setitimer				__NR_COMMON_SYSCALL(38)
+__SYSCALL(__NR_setitimer, sys_setitimer)
+#define __NR_getpid				__NR_COMMON_SYSCALL(39)
+__SYSCALL(__NR_getpid, sys_getpid)
+
+#define __NR_sendfile				__NR_COMMON_SYSCALL(40)
+__SYSCALL(__NR_sendfile, sys_sendfile64)
+#define __NR_socket				__NR_COMMON_SYSCALL(41)
+__SYSCALL(__NR_socket, sys_socket)
+#define __NR_connect				__NR_COMMON_SYSCALL(42)
+__SYSCALL(__NR_connect, sys_connect)
+#define __NR_accept				__NR_COMMON_SYSCALL(43)
+__SYSCALL(__NR_accept, sys_accept)
+#define __NR_sendto				__NR_COMMON_SYSCALL(44)
+__SYSCALL(__NR_sendto, sys_sendto)
+
+#define __NR_shutdown				__NR_COMMON_SYSCALL(48)
+__SYSCALL(__NR_shutdown, sys_shutdown)
+#define __NR_bind				__NR_COMMON_SYSCALL(49)
+__SYSCALL(__NR_bind, sys_bind)
+#define __NR_listen				__NR_COMMON_SYSCALL(50)
+__SYSCALL(__NR_listen, sys_listen)
+#define __NR_getsockname			__NR_COMMON_SYSCALL(51)
+__SYSCALL(__NR_getsockname, sys_getsockname)
+#define __NR_getpeername			__NR_COMMON_SYSCALL(52)
+__SYSCALL(__NR_getpeername, sys_getpeername)
+#define __NR_socketpair				__NR_COMMON_SYSCALL(53)
+__SYSCALL(__NR_socketpair, sys_socketpair)
+#define __NR_setsockopt				__NR_COMMON_SYSCALL(54)
+__SYSCALL(__NR_setsockopt, sys_setsockopt)
+#define __NR_getsockopt				__NR_COMMON_SYSCALL(55)
+__SYSCALL(__NR_getsockopt, sys_getsockopt)
+
+#define __NR_clone				__NR_COMMON_SYSCALL(56)
+__SYSCALL(__NR_clone, stub_clone)
+#define __NR_fork				__NR_COMMON_SYSCALL(57)
+__SYSCALL(__NR_fork, stub_fork)
+#define __NR_vfork				__NR_COMMON_SYSCALL(58)
+__SYSCALL(__NR_vfork, stub_vfork)
+#define __NR_exit				__NR_COMMON_SYSCALL(60)
+__SYSCALL(__NR_exit, sys_exit)
+#define __NR_wait4				__NR_COMMON_SYSCALL(61)
+__SYSCALL(__NR_wait4, sys_wait4)
+#define __NR_kill				__NR_COMMON_SYSCALL(62)
+__SYSCALL(__NR_kill, sys_kill)
+#define __NR_uname				__NR_COMMON_SYSCALL(63)
+__SYSCALL(__NR_uname, sys_newuname)
+
+#define __NR_semget				__NR_COMMON_SYSCALL(64)
+__SYSCALL(__NR_semget, sys_semget)
+#define __NR_semop				__NR_COMMON_SYSCALL(65)
+__SYSCALL(__NR_semop, sys_semop)
+#define __NR_semctl				__NR_COMMON_SYSCALL(66)
+__SYSCALL(__NR_semctl, sys_semctl)
+#define __NR_shmdt				__NR_COMMON_SYSCALL(67)
+__SYSCALL(__NR_shmdt, sys_shmdt)
+#define __NR_msgget				__NR_COMMON_SYSCALL(68)
+__SYSCALL(__NR_msgget, sys_msgget)
+#define __NR_msgsnd				__NR_COMMON_SYSCALL(69)
+__SYSCALL(__NR_msgsnd, sys_msgsnd)
+#define __NR_msgrcv				__NR_COMMON_SYSCALL(70)
+__SYSCALL(__NR_msgrcv, sys_msgrcv)
+#define __NR_msgctl				__NR_COMMON_SYSCALL(71)
+__SYSCALL(__NR_msgctl, sys_msgctl)
+
+#define __NR_fcntl				__NR_COMMON_SYSCALL(72)
+__SYSCALL(__NR_fcntl, sys_fcntl)
+#define __NR_flock				__NR_COMMON_SYSCALL(73)
+__SYSCALL(__NR_flock, sys_flock)
+#define __NR_fsync				__NR_COMMON_SYSCALL(74)
+__SYSCALL(__NR_fsync, sys_fsync)
+#define __NR_fdatasync				__NR_COMMON_SYSCALL(75)
+__SYSCALL(__NR_fdatasync, sys_fdatasync)
+#define __NR_truncate				__NR_COMMON_SYSCALL(76)
+__SYSCALL(__NR_truncate, sys_truncate)
+#define __NR_ftruncate				__NR_COMMON_SYSCALL(77)
+__SYSCALL(__NR_ftruncate, sys_ftruncate)
+#define __NR_getcwd				__NR_COMMON_SYSCALL(79)
+__SYSCALL(__NR_getcwd, sys_getcwd)
+
+#define __NR_chdir				__NR_COMMON_SYSCALL(80)
+__SYSCALL(__NR_chdir, sys_chdir)
+#define __NR_fchdir				__NR_COMMON_SYSCALL(81)
+__SYSCALL(__NR_fchdir, sys_fchdir)
+#define __NR_rename				__NR_COMMON_SYSCALL(82)
+__SYSCALL(__NR_rename, sys_rename)
+#define __NR_mkdir				__NR_COMMON_SYSCALL(83)
+__SYSCALL(__NR_mkdir, sys_mkdir)
+#define __NR_rmdir				__NR_COMMON_SYSCALL(84)
+__SYSCALL(__NR_rmdir, sys_rmdir)
+#define __NR_creat				__NR_COMMON_SYSCALL(85)
+__SYSCALL(__NR_creat, sys_creat)
+#define __NR_link				__NR_COMMON_SYSCALL(86)
+__SYSCALL(__NR_link, sys_link)
+#define __NR_unlink				__NR_COMMON_SYSCALL(87)
+__SYSCALL(__NR_unlink, sys_unlink)
+
+#define __NR_symlink				__NR_COMMON_SYSCALL(88)
+__SYSCALL(__NR_symlink, sys_symlink)
+#define __NR_readlink				__NR_COMMON_SYSCALL(89)
+__SYSCALL(__NR_readlink, sys_readlink)
+#define __NR_chmod				__NR_COMMON_SYSCALL(90)
+__SYSCALL(__NR_chmod, sys_chmod)
+#define __NR_fchmod				__NR_COMMON_SYSCALL(91)
+__SYSCALL(__NR_fchmod, sys_fchmod)
+#define __NR_chown				__NR_COMMON_SYSCALL(92)
+__SYSCALL(__NR_chown, sys_chown)
+#define __NR_fchown				__NR_COMMON_SYSCALL(93)
+__SYSCALL(__NR_fchown, sys_fchown)
+#define __NR_lchown				__NR_COMMON_SYSCALL(94)
+__SYSCALL(__NR_lchown, sys_lchown)
+#define __NR_umask				__NR_COMMON_SYSCALL(95)
+__SYSCALL(__NR_umask, sys_umask)
+
+#define __NR_gettimeofday			__NR_COMMON_SYSCALL(96)
+__SYSCALL(__NR_gettimeofday, sys_gettimeofday)
+#define __NR_getrlimit				__NR_COMMON_SYSCALL(97)
+__SYSCALL(__NR_getrlimit, sys_getrlimit)
+#define __NR_getrusage				__NR_COMMON_SYSCALL(98)
+__SYSCALL(__NR_getrusage, sys_getrusage)
+#define __NR_sysinfo				__NR_COMMON_SYSCALL(99)
+__SYSCALL(__NR_sysinfo, sys_sysinfo)
+#define __NR_ptrace				__NR_COMMON_SYSCALL(101)
+__SYSCALL(__NR_ptrace, sys_ptrace)
+#define __NR_getuid				__NR_COMMON_SYSCALL(102)
+__SYSCALL(__NR_getuid, sys_getuid)
+#define __NR_syslog				__NR_COMMON_SYSCALL(103)
+__SYSCALL(__NR_syslog, sys_syslog)
+
+/* at the very end the stuff that never runs during the benchmarks */
+#define __NR_getgid				__NR_COMMON_SYSCALL(104)
+__SYSCALL(__NR_getgid, sys_getgid)
+#define __NR_setuid				__NR_COMMON_SYSCALL(105)
+__SYSCALL(__NR_setuid, sys_setuid)
+#define __NR_setgid				__NR_COMMON_SYSCALL(106)
+__SYSCALL(__NR_setgid, sys_setgid)
+#define __NR_geteuid				__NR_COMMON_SYSCALL(107)
+__SYSCALL(__NR_geteuid, sys_geteuid)
+#define __NR_getegid				__NR_COMMON_SYSCALL(108)
+__SYSCALL(__NR_getegid, sys_getegid)
+#define __NR_setpgid				__NR_COMMON_SYSCALL(109)
+__SYSCALL(__NR_setpgid, sys_setpgid)
+#define __NR_getppid				__NR_COMMON_SYSCALL(110)
+__SYSCALL(__NR_getppid, sys_getppid)
+#define __NR_getpgrp				__NR_COMMON_SYSCALL(111)
+__SYSCALL(__NR_getpgrp, sys_getpgrp)
+
+#define __NR_setsid				__NR_COMMON_SYSCALL(112)
+__SYSCALL(__NR_setsid, sys_setsid)
+#define __NR_setreuid				__NR_COMMON_SYSCALL(113)
+__SYSCALL(__NR_setreuid, sys_setreuid)
+#define __NR_setregid				__NR_COMMON_SYSCALL(114)
+__SYSCALL(__NR_setregid, sys_setregid)
+#define __NR_getgroups				__NR_COMMON_SYSCALL(115)
+__SYSCALL(__NR_getgroups, sys_getgroups)
+#define __NR_setgroups				__NR_COMMON_SYSCALL(116)
+__SYSCALL(__NR_setgroups, sys_setgroups)
+#define __NR_setresuid				__NR_COMMON_SYSCALL(117)
+__SYSCALL(__NR_setresuid, sys_setresuid)
+#define __NR_getresuid				__NR_COMMON_SYSCALL(118)
+__SYSCALL(__NR_getresuid, sys_getresuid)
+#define __NR_setresgid				__NR_COMMON_SYSCALL(119)
+__SYSCALL(__NR_setresgid, sys_setresgid)
+
+#define __NR_getresgid				__NR_COMMON_SYSCALL(120)
+__SYSCALL(__NR_getresgid, sys_getresgid)
+#define __NR_getpgid				__NR_COMMON_SYSCALL(121)
+__SYSCALL(__NR_getpgid, sys_getpgid)
+#define __NR_setfsuid				__NR_COMMON_SYSCALL(122)
+__SYSCALL(__NR_setfsuid, sys_setfsuid)
+#define __NR_setfsgid				__NR_COMMON_SYSCALL(123)
+__SYSCALL(__NR_setfsgid, sys_setfsgid)
+#define __NR_getsid				__NR_COMMON_SYSCALL(124)
+__SYSCALL(__NR_getsid, sys_getsid)
+#define __NR_capget				__NR_COMMON_SYSCALL(125)
+__SYSCALL(__NR_capget, sys_capget)
+#define __NR_capset				__NR_COMMON_SYSCALL(126)
+__SYSCALL(__NR_capset, sys_capset)
+
+#define __NR_rt_sigsuspend			__NR_COMMON_SYSCALL(130)
+__SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend)
+#define __NR_utime				__NR_COMMON_SYSCALL(132)
+__SYSCALL(__NR_utime, sys_utime)
+#define __NR_mknod				__NR_COMMON_SYSCALL(133)
+__SYSCALL(__NR_mknod, sys_mknod)
+
+/* Only needed for a.out */
+#define __NR_personality			__NR_COMMON_SYSCALL(135)
+__SYSCALL(__NR_personality, sys_personality)
+
+#define __NR_ustat				__NR_COMMON_SYSCALL(136)
+__SYSCALL(__NR_ustat, sys_ustat)
+#define __NR_statfs				__NR_COMMON_SYSCALL(137)
+__SYSCALL(__NR_statfs, sys_statfs)
+#define __NR_fstatfs				__NR_COMMON_SYSCALL(138)
+__SYSCALL(__NR_fstatfs, sys_fstatfs)
+#define __NR_sysfs				__NR_COMMON_SYSCALL(139)
+__SYSCALL(__NR_sysfs, sys_sysfs)
+
+#define __NR_getpriority			__NR_COMMON_SYSCALL(140)
+__SYSCALL(__NR_getpriority, sys_getpriority)
+#define __NR_setpriority			__NR_COMMON_SYSCALL(141)
+__SYSCALL(__NR_setpriority, sys_setpriority)
+#define __NR_sched_setparam			__NR_COMMON_SYSCALL(142)
+__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
+#define __NR_sched_getparam			__NR_COMMON_SYSCALL(143)
+__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
+#define __NR_sched_setscheduler			__NR_COMMON_SYSCALL(144)
+__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
+#define __NR_sched_getscheduler			__NR_COMMON_SYSCALL(145)
+__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
+#define __NR_sched_get_priority_max		__NR_COMMON_SYSCALL(146)
+__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
+#define __NR_sched_get_priority_min		__NR_COMMON_SYSCALL(147)
+__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
+#define __NR_sched_rr_get_interval		__NR_COMMON_SYSCALL(148)
+__SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval)
+
+#define __NR_mlock				__NR_COMMON_SYSCALL(149)
+__SYSCALL(__NR_mlock, sys_mlock)
+#define __NR_munlock				__NR_COMMON_SYSCALL(150)
+__SYSCALL(__NR_munlock, sys_munlock)
+#define __NR_mlockall				__NR_COMMON_SYSCALL(151)
+__SYSCALL(__NR_mlockall, sys_mlockall)
+#define __NR_munlockall				__NR_COMMON_SYSCALL(152)
+__SYSCALL(__NR_munlockall, sys_munlockall)
+
+#define __NR_vhangup				__NR_COMMON_SYSCALL(153)
+__SYSCALL(__NR_vhangup, sys_vhangup)
+
+#define __NR_modify_ldt				__NR_COMMON_SYSCALL(154)
+__SYSCALL(__NR_modify_ldt, sys_modify_ldt)
+
+#define __NR_pivot_root				__NR_COMMON_SYSCALL(155)
+__SYSCALL(__NR_pivot_root, sys_pivot_root)
+
+
+#define __NR_prctl				__NR_COMMON_SYSCALL(157)
+__SYSCALL(__NR_prctl, sys_prctl)
+#define __NR_arch_prctl				__NR_COMMON_SYSCALL(158)
+__SYSCALL(__NR_arch_prctl, sys_arch_prctl)
+
+#define __NR_adjtimex				__NR_COMMON_SYSCALL(159)
+__SYSCALL(__NR_adjtimex, sys_adjtimex)
+
+#define __NR_setrlimit				__NR_COMMON_SYSCALL(160)
+__SYSCALL(__NR_setrlimit, sys_setrlimit)
+
+#define __NR_chroot				__NR_COMMON_SYSCALL(161)
+__SYSCALL(__NR_chroot, sys_chroot)
+
+#define __NR_sync				__NR_COMMON_SYSCALL(162)
+__SYSCALL(__NR_sync, sys_sync)
+
+#define __NR_acct				__NR_COMMON_SYSCALL(163)
+__SYSCALL(__NR_acct, sys_acct)
+
+#define __NR_settimeofday			__NR_COMMON_SYSCALL(164)
+__SYSCALL(__NR_settimeofday, sys_settimeofday)
+
+#define __NR_mount				__NR_COMMON_SYSCALL(165)
+__SYSCALL(__NR_mount, sys_mount)
+#define __NR_umount2				__NR_COMMON_SYSCALL(166)
+__SYSCALL(__NR_umount2, sys_umount)
+
+#define __NR_swapon				__NR_COMMON_SYSCALL(167)
+__SYSCALL(__NR_swapon, sys_swapon)
+#define __NR_swapoff				__NR_COMMON_SYSCALL(168)
+__SYSCALL(__NR_swapoff, sys_swapoff)
+
+#define __NR_reboot				__NR_COMMON_SYSCALL(169)
+__SYSCALL(__NR_reboot, sys_reboot)
+
+#define __NR_sethostname			__NR_COMMON_SYSCALL(170)
+__SYSCALL(__NR_sethostname, sys_sethostname)
+#define __NR_setdomainname			__NR_COMMON_SYSCALL(171)
+__SYSCALL(__NR_setdomainname, sys_setdomainname)
+
+#define __NR_iopl				__NR_COMMON_SYSCALL(172)
+__SYSCALL(__NR_iopl, stub_iopl)
+#define __NR_ioperm				__NR_COMMON_SYSCALL(173)
+__SYSCALL(__NR_ioperm, sys_ioperm)
+
+#define __NR_init_module			__NR_COMMON_SYSCALL(175)
+__SYSCALL(__NR_init_module, sys_init_module)
+#define __NR_delete_module			__NR_COMMON_SYSCALL(176)
+__SYSCALL(__NR_delete_module, sys_delete_module)
+
+#define __NR_quotactl				__NR_COMMON_SYSCALL(179)
+__SYSCALL(__NR_quotactl, sys_quotactl)
+
+
+/* reserved for LiS/STREAMS */
+#define __NR_getpmsg				__NR_COMMON_SYSCALL(181)
+__SYSCALL(__NR_getpmsg, sys_ni_syscall)
+#define __NR_putpmsg				__NR_COMMON_SYSCALL(182)
+__SYSCALL(__NR_putpmsg, sys_ni_syscall)
+
+/* reserved for AFS */
+#define __NR_afs_syscall			__NR_COMMON_SYSCALL(183)
+__SYSCALL(__NR_afs_syscall, sys_ni_syscall)
+
+/* reserved for tux */
+#define __NR_tuxcall				__NR_COMMON_SYSCALL(184)
+__SYSCALL(__NR_tuxcall, sys_ni_syscall)
+
+#define __NR_security				__NR_COMMON_SYSCALL(185)
+__SYSCALL(__NR_security, sys_ni_syscall)
+
+#define __NR_gettid				__NR_COMMON_SYSCALL(186)
+__SYSCALL(__NR_gettid, sys_gettid)
+
+#define __NR_readahead				__NR_COMMON_SYSCALL(187)
+__SYSCALL(__NR_readahead, sys_readahead)
+#define __NR_setxattr				__NR_COMMON_SYSCALL(188)
+__SYSCALL(__NR_setxattr, sys_setxattr)
+#define __NR_lsetxattr				__NR_COMMON_SYSCALL(189)
+__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
+#define __NR_fsetxattr				__NR_COMMON_SYSCALL(190)
+__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
+#define __NR_getxattr				__NR_COMMON_SYSCALL(191)
+__SYSCALL(__NR_getxattr, sys_getxattr)
+#define __NR_lgetxattr				__NR_COMMON_SYSCALL(192)
+__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
+#define __NR_fgetxattr				__NR_COMMON_SYSCALL(193)
+__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
+#define __NR_listxattr				__NR_COMMON_SYSCALL(194)
+__SYSCALL(__NR_listxattr, sys_listxattr)
+#define __NR_llistxattr				__NR_COMMON_SYSCALL(195)
+__SYSCALL(__NR_llistxattr, sys_llistxattr)
+#define __NR_flistxattr				__NR_COMMON_SYSCALL(196)
+__SYSCALL(__NR_flistxattr, sys_flistxattr)
+#define __NR_removexattr			__NR_COMMON_SYSCALL(197)
+__SYSCALL(__NR_removexattr, sys_removexattr)
+#define __NR_lremovexattr			__NR_COMMON_SYSCALL(198)
+__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
+#define __NR_fremovexattr			__NR_COMMON_SYSCALL(199)
+__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
+#define __NR_tkill				__NR_COMMON_SYSCALL(200)
+__SYSCALL(__NR_tkill, sys_tkill)
+#define __NR_time				__NR_COMMON_SYSCALL(201)
+__SYSCALL(__NR_time, sys_time)
+#define __NR_futex				__NR_COMMON_SYSCALL(202)
+__SYSCALL(__NR_futex, sys_futex)
+#define __NR_sched_setaffinity			__NR_COMMON_SYSCALL(203)
+__SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity)
+#define __NR_sched_getaffinity			__NR_COMMON_SYSCALL(204)
+__SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity)
+#define __NR_io_setup				__NR_COMMON_SYSCALL(206)
+__SYSCALL(__NR_io_setup, sys_io_setup)
+#define __NR_io_destroy				__NR_COMMON_SYSCALL(207)
+__SYSCALL(__NR_io_destroy, sys_io_destroy)
+#define __NR_io_getevents			__NR_COMMON_SYSCALL(208)
+__SYSCALL(__NR_io_getevents, sys_io_getevents)
+#define __NR_io_submit				__NR_COMMON_SYSCALL(209)
+__SYSCALL(__NR_io_submit, sys_io_submit)
+#define __NR_io_cancel				__NR_COMMON_SYSCALL(210)
+__SYSCALL(__NR_io_cancel, sys_io_cancel)
+#define __NR_lookup_dcookie			__NR_COMMON_SYSCALL(212)
+__SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie)
+#define __NR_epoll_create			__NR_COMMON_SYSCALL(213)
+__SYSCALL(__NR_epoll_create, sys_epoll_create)
+#define __NR_remap_file_pages			__NR_COMMON_SYSCALL(216)
+__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
+#define __NR_getdents64				__NR_COMMON_SYSCALL(217)
+__SYSCALL(__NR_getdents64, sys_getdents64)
+#define __NR_set_tid_address			__NR_COMMON_SYSCALL(218)
+__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
+#define __NR_restart_syscall			__NR_COMMON_SYSCALL(219)
+__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
+#define __NR_semtimedop				__NR_COMMON_SYSCALL(220)
+__SYSCALL(__NR_semtimedop, sys_semtimedop)
+#define __NR_fadvise64				__NR_COMMON_SYSCALL(221)
+__SYSCALL(__NR_fadvise64, sys_fadvise64)
+#define __NR_timer_settime			__NR_COMMON_SYSCALL(223)
+__SYSCALL(__NR_timer_settime, sys_timer_settime)
+#define __NR_timer_gettime			__NR_COMMON_SYSCALL(224)
+__SYSCALL(__NR_timer_gettime, sys_timer_gettime)
+#define __NR_timer_getoverrun			__NR_COMMON_SYSCALL(225)
+__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
+#define __NR_timer_delete			__NR_COMMON_SYSCALL(226)
+__SYSCALL(__NR_timer_delete, sys_timer_delete)
+#define __NR_clock_settime			__NR_COMMON_SYSCALL(227)
+__SYSCALL(__NR_clock_settime, sys_clock_settime)
+#define __NR_clock_gettime			__NR_COMMON_SYSCALL(228)
+__SYSCALL(__NR_clock_gettime, sys_clock_gettime)
+#define __NR_clock_getres			__NR_COMMON_SYSCALL(229)
+__SYSCALL(__NR_clock_getres, sys_clock_getres)
+#define __NR_clock_nanosleep			__NR_COMMON_SYSCALL(230)
+__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
+#define __NR_exit_group				__NR_COMMON_SYSCALL(231)
+__SYSCALL(__NR_exit_group, sys_exit_group)
+#define __NR_epoll_wait				__NR_COMMON_SYSCALL(232)
+__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
+#define __NR_epoll_ctl				__NR_COMMON_SYSCALL(233)
+__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
+#define __NR_tgkill				__NR_COMMON_SYSCALL(234)
+__SYSCALL(__NR_tgkill, sys_tgkill)
+#define __NR_utimes				__NR_COMMON_SYSCALL(235)
+__SYSCALL(__NR_utimes, sys_utimes)
+#define __NR_mbind				__NR_COMMON_SYSCALL(237)
+__SYSCALL(__NR_mbind, sys_mbind)
+#define __NR_set_mempolicy			__NR_COMMON_SYSCALL(238)
+__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
+#define __NR_get_mempolicy			__NR_COMMON_SYSCALL(239)
+__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
+#define __NR_mq_open				__NR_COMMON_SYSCALL(240)
+__SYSCALL(__NR_mq_open, sys_mq_open)
+#define __NR_mq_unlink				__NR_COMMON_SYSCALL(241)
+__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
+#define __NR_mq_timedsend			__NR_COMMON_SYSCALL(242)
+__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
+#define __NR_mq_timedreceive			__NR_COMMON_SYSCALL(243)
+__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
+#define __NR_mq_getsetattr			__NR_COMMON_SYSCALL(245)
+__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
+#define __NR_add_key				__NR_COMMON_SYSCALL(248)
+__SYSCALL(__NR_add_key, sys_add_key)
+#define __NR_request_key			__NR_COMMON_SYSCALL(249)
+__SYSCALL(__NR_request_key, sys_request_key)
+#define __NR_keyctl				__NR_COMMON_SYSCALL(250)
+__SYSCALL(__NR_keyctl, sys_keyctl)
+#define __NR_ioprio_set				__NR_COMMON_SYSCALL(251)
+__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
+#define __NR_ioprio_get				__NR_COMMON_SYSCALL(252)
+__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
+#define __NR_inotify_init			__NR_COMMON_SYSCALL(253)
+__SYSCALL(__NR_inotify_init, sys_inotify_init)
+#define __NR_inotify_add_watch			__NR_COMMON_SYSCALL(254)
+__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
+#define __NR_inotify_rm_watch			__NR_COMMON_SYSCALL(255)
+__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
+#define __NR_migrate_pages			__NR_COMMON_SYSCALL(256)
+__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
+#define __NR_openat				__NR_COMMON_SYSCALL(257)
+__SYSCALL(__NR_openat, sys_openat)
+#define __NR_mkdirat				__NR_COMMON_SYSCALL(258)
+__SYSCALL(__NR_mkdirat, sys_mkdirat)
+#define __NR_mknodat				__NR_COMMON_SYSCALL(259)
+__SYSCALL(__NR_mknodat, sys_mknodat)
+#define __NR_fchownat				__NR_COMMON_SYSCALL(260)
+__SYSCALL(__NR_fchownat, sys_fchownat)
+#define __NR_futimesat				__NR_COMMON_SYSCALL(261)
+__SYSCALL(__NR_futimesat, sys_futimesat)
+#define __NR_newfstatat				__NR_COMMON_SYSCALL(262)
+__SYSCALL(__NR_newfstatat, sys_newfstatat)
+#define __NR_unlinkat				__NR_COMMON_SYSCALL(263)
+__SYSCALL(__NR_unlinkat, sys_unlinkat)
+#define __NR_renameat				__NR_COMMON_SYSCALL(264)
+__SYSCALL(__NR_renameat, sys_renameat)
+#define __NR_linkat				__NR_COMMON_SYSCALL(265)
+__SYSCALL(__NR_linkat, sys_linkat)
+#define __NR_symlinkat				__NR_COMMON_SYSCALL(266)
+__SYSCALL(__NR_symlinkat, sys_symlinkat)
+#define __NR_readlinkat				__NR_COMMON_SYSCALL(267)
+__SYSCALL(__NR_readlinkat, sys_readlinkat)
+#define __NR_fchmodat				__NR_COMMON_SYSCALL(268)
+__SYSCALL(__NR_fchmodat, sys_fchmodat)
+#define __NR_faccessat				__NR_COMMON_SYSCALL(269)
+__SYSCALL(__NR_faccessat, sys_faccessat)
+#define __NR_pselect6				__NR_COMMON_SYSCALL(270)
+__SYSCALL(__NR_pselect6, sys_pselect6)
+#define __NR_ppoll				__NR_COMMON_SYSCALL(271)
+__SYSCALL(__NR_ppoll, sys_ppoll)
+#define __NR_unshare				__NR_COMMON_SYSCALL(272)
+__SYSCALL(__NR_unshare,	sys_unshare)
+#define __NR_splice				__NR_COMMON_SYSCALL(275)
+__SYSCALL(__NR_splice, sys_splice)
+#define __NR_tee				__NR_COMMON_SYSCALL(276)
+__SYSCALL(__NR_tee, sys_tee)
+#define __NR_sync_file_range			__NR_COMMON_SYSCALL(277)
+__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
+#define __NR_utimensat				__NR_COMMON_SYSCALL(280)
+__SYSCALL(__NR_utimensat, sys_utimensat)
+#define __NR_epoll_pwait			__NR_COMMON_SYSCALL(281)
+__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
+#define __NR_signalfd				__NR_COMMON_SYSCALL(282)
+__SYSCALL(__NR_signalfd, sys_signalfd)
+#define __NR_timerfd_create			__NR_COMMON_SYSCALL(283)
+__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
+#define __NR_eventfd				__NR_COMMON_SYSCALL(284)
+__SYSCALL(__NR_eventfd, sys_eventfd)
+#define __NR_fallocate				__NR_COMMON_SYSCALL(285)
+__SYSCALL(__NR_fallocate, sys_fallocate)
+#define __NR_timerfd_settime			__NR_COMMON_SYSCALL(286)
+__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
+#define __NR_timerfd_gettime			__NR_COMMON_SYSCALL(287)
+__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
+#define __NR_accept4				__NR_COMMON_SYSCALL(288)
+__SYSCALL(__NR_accept4, sys_accept4)
+#define __NR_signalfd4				__NR_COMMON_SYSCALL(289)
+__SYSCALL(__NR_signalfd4, sys_signalfd4)
+#define __NR_eventfd2				__NR_COMMON_SYSCALL(290)
+__SYSCALL(__NR_eventfd2, sys_eventfd2)
+#define __NR_epoll_create1			__NR_COMMON_SYSCALL(291)
+__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
+#define __NR_dup3				__NR_COMMON_SYSCALL(292)
+__SYSCALL(__NR_dup3, sys_dup3)
+#define __NR_pipe2				__NR_COMMON_SYSCALL(293)
+__SYSCALL(__NR_pipe2, sys_pipe2)
+#define __NR_inotify_init1			__NR_COMMON_SYSCALL(294)
+__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
+#define __NR_perf_event_open			__NR_COMMON_SYSCALL(298)
+__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
+#define __NR_fanotify_init			__NR_COMMON_SYSCALL(300)
+__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
+#define __NR_fanotify_mark			__NR_COMMON_SYSCALL(301)
+__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
+#define __NR_prlimit64				__NR_COMMON_SYSCALL(302)
+__SYSCALL(__NR_prlimit64, sys_prlimit64)
+#define __NR_name_to_handle_at			__NR_COMMON_SYSCALL(303)
+__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
+#define __NR_open_by_handle_at			__NR_COMMON_SYSCALL(304)
+__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
+#define __NR_clock_adjtime			__NR_COMMON_SYSCALL(305)
+__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
+#define __NR_syncfs                             __NR_COMMON_SYSCALL(306)
+__SYSCALL(__NR_syncfs, sys_syncfs)
+#define __NR_setns				__NR_COMMON_SYSCALL(308)
+__SYSCALL(__NR_setns, sys_setns)
+#define __NR_getcpu				__NR_COMMON_SYSCALL(309)
+__SYSCALL(__NR_getcpu, sys_getcpu)
+
+/* X32 support.  */
+#define __NR_rt_sigaction			__NR_X32_SYSCALL(0)
+__X32_SYSCALL(__NR_rt_sigaction, sys32_rt_sigaction)
+#define __NR_rt_sigprocmask			__NR_X32_SYSCALL(1)
+__X32_SYSCALL(__NR_rt_sigprocmask, sys32_rt_sigprocmask)
+#define __NR_rt_sigreturn			__NR_X32_SYSCALL(2)
+__X32_SYSCALL(__NR_rt_sigreturn, stub_x32_rt_sigreturn)
+#define __NR_ioctl				__NR_X32_SYSCALL(3)
+__X32_SYSCALL(__NR_ioctl, compat_sys_ioctl)
+#define __NR_readv				__NR_X32_SYSCALL(4)
+__X32_SYSCALL(__NR_readv, compat_sys_readv)
+#define __NR_writev				__NR_X32_SYSCALL(5)
+__X32_SYSCALL(__NR_writev, compat_sys_writev)
+#define __NR_recvfrom			__NR_X32_SYSCALL(6)
+__X32_SYSCALL(__NR_recvfrom, compat_sys_recvfrom)
+#define __NR_sendmsg			__NR_X32_SYSCALL(7)
+__X32_SYSCALL(__NR_sendmsg, compat_sys_sendmsg)
+
+#define __NR_recvmsg			__NR_X32_SYSCALL(8)
+__X32_SYSCALL(__NR_recvmsg, compat_sys_recvmsg)
+#define __NR_execve				__NR_X32_SYSCALL(9)
+__X32_SYSCALL(__NR_execve, stub_x32_execve)
+#define __NR_times				__NR_X32_SYSCALL(10)
+__X32_SYSCALL(__NR_times, compat_sys_times)
+#define __NR_rt_sigpending			__NR_X32_SYSCALL(11)
+__X32_SYSCALL(__NR_rt_sigpending, sys32_rt_sigpending)
+#define __NR_rt_sigtimedwait		__NR_X32_SYSCALL(12)
+__X32_SYSCALL(__NR_rt_sigtimedwait, compat_sys_rt_sigtimedwait)
+#define __NR_rt_sigqueueinfo		__NR_X32_SYSCALL(13)
+__X32_SYSCALL(__NR_rt_sigqueueinfo, sys32_rt_sigqueueinfo)
+#define __NR_sigaltstack			__NR_X32_SYSCALL(14)
+__X32_SYSCALL(__NR_sigaltstack, stub_x32_sigaltstack)
+#define __NR_timer_create			__NR_X32_SYSCALL(15)
+__X32_SYSCALL(__NR_timer_create, compat_sys_timer_create)
+
+#define __NR_mq_notify			__NR_X32_SYSCALL(16)
+__X32_SYSCALL(__NR_mq_notify, compat_sys_mq_notify)
+#define __NR_kexec_load			__NR_X32_SYSCALL(17)
+__X32_SYSCALL(__NR_kexec_load, compat_sys_kexec_load)
+#define __NR_waitid				__NR_X32_SYSCALL(18)
+__X32_SYSCALL(__NR_waitid, compat_sys_waitid)
+#define __NR_set_robust_list		__NR_X32_SYSCALL(19)
+__X32_SYSCALL(__NR_set_robust_list, compat_sys_set_robust_list)
+#define __NR_get_robust_list		__NR_X32_SYSCALL(20)
+__X32_SYSCALL(__NR_get_robust_list, compat_sys_get_robust_list)
+#define __NR_vmsplice			__NR_X32_SYSCALL(21)
+__X32_SYSCALL(__NR_vmsplice, compat_sys_vmsplice)
+#define __NR_move_pages			__NR_X32_SYSCALL(22)
+__X32_SYSCALL(__NR_move_pages, compat_sys_move_pages)
+#define __NR_preadv				__NR_X32_SYSCALL(23)
+__SYSCALL(__NR_preadv, compat_sys_preadv64)
+
+#define __NR_pwritev			__NR_X32_SYSCALL(24)
+__SYSCALL(__NR_pwritev, compat_sys_pwritev64)
+#define __NR_rt_tgsigqueueinfo		__NR_X32_SYSCALL(25)
+__X32_SYSCALL(__NR_rt_tgsigqueueinfo, compat_sys_rt_tgsigqueueinfo)
+#define __NR_recvmmsg			__NR_X32_SYSCALL(26)
+__SYSCALL(__NR_recvmmsg, compat_sys_recvmmsg)
+#define __NR_sendmmsg			__NR_X32_SYSCALL(27)
+__SYSCALL(__NR_sendmmsg, compat_sys_sendmmsg)
+#define __NR_process_vm_readv		__NR_X32_SYSCALL(28)
+__SYSCALL(__NR_process_vm_readv, compat_sys_process_vm_readv)
+#define __NR_process_vm_writev		__NR_X32_SYSCALL(29)
+
+#ifndef __NO_STUBS
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLD_UNAME
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#define __ARCH_WANT_SYS_RT_SIGSUSPEND
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_COMPAT_SYS_TIME
+#endif	/* __NO_STUBS */
+
+#ifdef __KERNEL__
+
+#ifndef COMPILE_OFFSETS
+#include <asm/asm-offsets.h>
+#define NR_syscalls (__NR_syscall_max + 1)
+#endif
+
+/*
+ * "Conditional" syscalls
+ *
+ * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
+ * but it doesn't work on all toolchains, so we just do it by hand
+ */
+#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
+#endif	/* __KERNEL__ */
+
+#endif /* _ASM_X86_UNISTD_X32_H */
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
index 7a0f69e..6566370 100644
--- a/include/asm-generic/types.h
+++ b/include/asm-generic/types.h
@@ -12,4 +12,8 @@ typedef unsigned short umode_t;
 
 #endif /* __ASSEMBLY__ */
 
+#ifndef __KERNEL_NATIVE_LONG_TYPE
+#define __KERNEL_NATIVE_LONG_TYPE long
+#endif
+
 #endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 619b565..9485826 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -352,6 +352,7 @@ header-y += suspend_ioctls.h
 header-y += swab.h
 header-y += synclink.h
 header-y += sysctl.h
+header-y += sysinfo.h
 header-y += taskstats.h
 header-y += tcp.h
 header-y += telephony.h
diff --git a/include/linux/aio_abi.h b/include/linux/aio_abi.h
index 2c87316..0c3a4f3 100644
--- a/include/linux/aio_abi.h
+++ b/include/linux/aio_abi.h
@@ -30,7 +30,7 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-typedef unsigned long	aio_context_t;
+typedef unsigned __KERNEL_NATIVE_LONG_TYPE aio_context_t;
 
 enum {
 	IOCB_CMD_PREAD = 0,
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 66ed067..ebc1b69 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -19,6 +19,10 @@
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 
+#ifndef COMPAT_USE_64BIT_TIME
+#define COMPAT_USE_64BIT_TIME 0
+#endif
+
 #define compat_jiffies_to_clock_t(x)	\
 		(((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
 
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e8b1597..ecdf718 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -732,22 +732,6 @@ extern int do_sysinfo(struct sysinfo *info);
 
 #endif /* __KERNEL__ */
 
-#define SI_LOAD_SHIFT	16
-struct sysinfo {
-	long uptime;			/* Seconds since boot */
-	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
-	unsigned long totalram;		/* Total usable main memory size */
-	unsigned long freeram;		/* Available memory size */
-	unsigned long sharedram;	/* Amount of shared memory */
-	unsigned long bufferram;	/* Memory used by buffers */
-	unsigned long totalswap;	/* Total swap space size */
-	unsigned long freeswap;		/* swap space still available */
-	unsigned short procs;		/* Number of current processes */
-	unsigned short pad;		/* explicit padding for m68k */
-	unsigned long totalhigh;	/* Total high memory size */
-	unsigned long freehigh;		/* Available high memory size */
-	unsigned int mem_unit;		/* Memory unit size in bytes */
-	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
-};
+#include <linux/sysinfo.h>
 
 #endif
diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h
new file mode 100644
index 0000000..bf475e6
--- /dev/null
+++ b/include/linux/sysinfo.h
@@ -0,0 +1,38 @@
+#ifndef _LINUX_SYSINFO_H
+#define _LINUX_SYSINFO_H
+
+#include <linux/types.h>
+
+#define SI_LOAD_SHIFT	16
+struct sysinfo {
+	/* Seconds since boot */
+	__KERNEL_NATIVE_LONG_TYPE uptime;
+	/* 1, 5, and 15 minute load averages */
+	unsigned __KERNEL_NATIVE_LONG_TYPE loads[3];
+	/* Total usable main memory size */
+	unsigned __KERNEL_NATIVE_LONG_TYPE totalram;
+	/* Available memory size */
+	unsigned __KERNEL_NATIVE_LONG_TYPE freeram;
+	/* Amount of shared memory */
+	unsigned __KERNEL_NATIVE_LONG_TYPE sharedram;
+	/* Memory used by buffers */
+	unsigned __KERNEL_NATIVE_LONG_TYPE bufferram;
+	/* Total swap space size */
+	unsigned __KERNEL_NATIVE_LONG_TYPE totalswap;
+	/* swap space still available */
+	unsigned __KERNEL_NATIVE_LONG_TYPE freeswap;
+	/* Number of current processes */
+	unsigned short procs;
+	/* explicit padding for m68k */
+	unsigned short pad;
+	/* Total high memory size */
+	unsigned __KERNEL_NATIVE_LONG_TYPE totalhigh;
+	/* Available high memory size */
+	unsigned __KERNEL_NATIVE_LONG_TYPE freehigh;
+	/* Memory unit size in bytes */
+	unsigned int mem_unit;
+	/* Padding: libc5 uses this.. */
+	char _f[20-2*sizeof(__KERNEL_NATIVE_LONG_TYPE)-sizeof(int)];
+};
+
+#endif
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 48462be..a35aeb8 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -40,6 +40,7 @@ foreach my $file (@files) {
 		$line =~ s/\b([us](8|16|32|64))\b/__$1/g;
 		$line =~ s/\b(u_?int(8|16|32|64)_t)\b/__u$2/g;
 		$line =~ s/\b(int(8|16|32|64)_t)\b/__s$2/g;
+		$line =~ s/__NR_64_/__NR_/g;
 		printf {$out} "%s", $line;
 	}
 	close $out;






^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-07  4:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-07  4:26 [gentoo-commits] gentoo commit in src/patchsets/gentoo-headers/3.2: 00_all_0001-kbuild-auto-convert-size-types-in-userspace-headers.patch 00_all_0002-linux-stat.h-remove-__GLIBC__-checks.patch 00_all_0003-linux-stddef.h-export-offsetof-to-userspace.patch 00_all_0004-linux-pull-in-other-needed-headers-for-userspace.patch 00_all_0005-netfilter-pull-in-limits.h.patch 00_all_0006-convert-PAGE_SIZE-usage.patch 00_all_0007-asm-generic-fcntl.h-namespace-kernel-file-structs.patch 00_all_0008-unifdef-drop-unused-errno.h-include.patch 90_all_x32-3.2.patch Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox