add libaio-aarch64.patch

This commit is contained in:
Peter Robinson 2014-03-04 19:44:22 +00:00
parent beac4b73e2
commit a5a02a9b31

157
libaio-aarch64.patch Normal file
View File

@ -0,0 +1,157 @@
diff --git a/compat-libaio-0.3.109/src/libaio.h b/compat-libaio-0.3.109/src/libaio.h
index 18dbc2a..c03ff9c 100644
--- a/compat-libaio-0.3.109/src/libaio.h
+++ b/compat-libaio-0.3.109/src/libaio.h
@@ -91,6 +91,16 @@ typedef enum io_iocb_cmd {
#define PADDED(x, y) unsigned y; x
#define PADDEDptr(x, y) unsigned y; x
#define PADDEDul(x, y) unsigned y; unsigned long x
+#elif defined(__aarch64__)
+# if defined (__AARCH64EB__) /* big endian, 64 bits */
+#define PADDED(x, y) unsigned y; x
+#define PADDEDptr(x,y) x
+#define PADDEDul(x, y) unsigned long x
+# elif defined(__AARCH64EL__) /* little endian, 64 bits */
+#define PADDED(x, y) x, y
+#define PADDEDptr(x, y) x
+#define PADDEDul(x, y) unsigned long x
+# endif
#else
#error endian?
#endif
diff --git a/compat-libaio-0.3.109/src/syscall-generic.h b/compat-libaio-0.3.109/src/syscall-generic.h
new file mode 100644
index 0000000..6a9a41d
--- /dev/null
+++ b/compat-libaio-0.3.109/src/syscall-generic.h
@@ -0,0 +1,29 @@
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#define _body_io_syscall(sname, args...) \
+{ \
+ int ret = syscall(__NR_##sname, ## args); \
+ return ret < 0 ? -errno : ret; \
+}
+
+#define io_syscall1(type,fname,sname,type1,arg1) \
+type fname(type1 arg1) \
+_body_io_syscall(sname, (long)arg1)
+
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
+type fname(type1 arg1,type2 arg2) \
+_body_io_syscall(sname, (long)arg1, (long)arg2)
+
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
+type fname(type1 arg1,type2 arg2,type3 arg3) \
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3)
+
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4)
+
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5)
diff --git a/compat-libaio-0.3.109/src/syscall.h b/compat-libaio-0.3.109/src/syscall.h
index 62879a5..d9ee036 100644
--- a/compat-libaio-0.3.109/src/syscall.h
+++ b/compat-libaio-0.3.109/src/syscall.h
@@ -27,5 +27,6 @@
#elif defined(__sparc__)
#include "syscall-sparc.h"
#else
-#error "add syscall-arch.h"
+#warning "using generic syscall method"
+#include "syscall-generic.h"
#endif
diff --git a/harness/cases/16.t b/harness/cases/16.t
index c3157cc..074756d 100644
--- a/harness/cases/16.t
+++ b/harness/cases/16.t
@@ -18,6 +18,8 @@
#define SYS_eventfd 318
#elif defined(__alpha__)
#define SYS_eventfd 478
+#elif defined(__aarch64__)
+#define SYS_eventfd 1044
#else
#error define SYS_eventfd for your arch!
#endif
diff --git a/src/libaio.h b/src/libaio.h
index 18dbc2a..15e12a7 100644
--- a/src/libaio.h
+++ b/src/libaio.h
@@ -1,6 +1,6 @@
/* /usr/include/libaio.h
*
- * Copyright 2000,2001,2002 Red Hat, Inc.
+ * Copyright 2000,2001,2002,2013 Red Hat, Inc.
*
* Written by Benjamin LaHaise <bcrl@redhat.com>
*
@@ -91,6 +91,16 @@ typedef enum io_iocb_cmd {
#define PADDED(x, y) unsigned y; x
#define PADDEDptr(x, y) unsigned y; x
#define PADDEDul(x, y) unsigned y; unsigned long x
+#elif defined(__aarch64__)
+# if defined (__AARCH64EB__) /* big endian, 64 bits */
+#define PADDED(x, y) unsigned y; x
+#define PADDEDptr(x,y) x
+#define PADDEDul(x, y) unsigned long x
+# elif defined(__AARCH64EL__) /* little endian, 64 bits */
+#define PADDED(x, y) x, y
+#define PADDEDptr(x, y) x
+#define PADDEDul(x, y) unsigned long x
+# endif
#else
#error endian?
#endif
diff --git a/src/syscall-generic.h b/src/syscall-generic.h
new file mode 100644
index 0000000..6a9a41d
--- /dev/null
+++ b/src/syscall-generic.h
@@ -0,0 +1,29 @@
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#define _body_io_syscall(sname, args...) \
+{ \
+ int ret = syscall(__NR_##sname, ## args); \
+ return ret < 0 ? -errno : ret; \
+}
+
+#define io_syscall1(type,fname,sname,type1,arg1) \
+type fname(type1 arg1) \
+_body_io_syscall(sname, (long)arg1)
+
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
+type fname(type1 arg1,type2 arg2) \
+_body_io_syscall(sname, (long)arg1, (long)arg2)
+
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
+type fname(type1 arg1,type2 arg2,type3 arg3) \
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3)
+
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4)
+
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5)
diff --git a/src/syscall.h b/src/syscall.h
index 62879a5..d9ee036 100644
--- a/src/syscall.h
+++ b/src/syscall.h
@@ -27,5 +27,6 @@
#elif defined(__sparc__)
#include "syscall-sparc.h"
#else
-#error "add syscall-arch.h"
+#warning "using generic syscall method"
+#include "syscall-generic.h"
#endif