Index: libaio-0.3.109/src/syscall-x86_64.h
===================================================================
--- libaio-0.3.109.orig/src/syscall-x86_64.h	2009-10-09 11:17:02.000000000 -0700
+++ libaio-0.3.109/src/syscall-x86_64.h	2013-03-03 07:15:13.000000000 -0800
@@ -1,8 +1,18 @@
+#ifndef __NR_io_setup
 #define __NR_io_setup		206
+#endif
+#ifndef __NR_io_destroy
 #define __NR_io_destroy		207
+#endif
+#ifndef __NR_io_getevents
 #define __NR_io_getevents	208
+#endif
+#ifndef __NR_io_submit
 #define __NR_io_submit		209
+#endif
+#ifndef __NR_io_cancel
 #define __NR_io_cancel		210
+#endif
 
 #define __syscall_clobber "r11","rcx","memory" 
 #define __syscall "syscall"
@@ -42,10 +52,11 @@
 type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4)		\
 {									\
 long __res;								\
-__asm__ volatile ("movq %5,%%r10 ;" __syscall				\
+register long __a4 asm ("r10") = (long) arg4;                           \
+__asm__ volatile (__syscall						\
 	: "=a" (__res)							\
 	: "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)),	\
-	  "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \
+	  "d" ((long)(arg3)),"r" (__a4)); \
 return __res;								\
 } 
 
@@ -54,10 +65,11 @@
 type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5)	\
 {									\
 long __res;								\
-__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall		\
+register long __a4 asm ("r10") = (long) arg4;				\
+register long __a5 asm ("r8") = (long) arg5;                            \
+__asm__ volatile (__syscall						\
 	: "=a" (__res)							\
 	: "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)),	\
-	  "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) :	\
-	__syscall_clobber,"r8","r10" );					\
+	  "d" ((long)(arg3)),"r" (__a4),"r" (__a5)); \
 return __res;								\
 }
Index: libaio-0.3.109/harness/main.c
===================================================================
--- libaio-0.3.109.orig/harness/main.c	2013-03-03 06:58:51.000000000 -0800
+++ libaio-0.3.109/harness/main.c	2013-03-03 07:23:40.000000000 -0800
@@ -14,7 +14,7 @@
 #if __LP64__ == 0
 #if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
 #define KERNEL_RW_POINTER	((void *)0xc0010000)
-#elif defined(__arm__) || defined(__m68k__) || defined(__s390__) || defined(__sh__)
+#elif defined(__arm__) || defined(__m68k__) || defined(__s390__) || defined(__sh__) || defined(__x86_64__)
 #define KERNEL_RW_POINTER	((void *)0x00010000)
 #elif defined(__hppa__)
 #define KERNEL_RW_POINTER	((void *)0x10100000)