summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen LaHaise <bcrl@kvack.org>2002-09-13 22:36:45 +0000
committerBen LaHaise <bcrl@kvack.org>2002-09-13 22:36:45 +0000
commita4984400f1d40c3cd9353ee2d817271c0fa3b4bd (patch)
treeda15ec3b720d773bdc0fd4f4fecb3d7bcbb5ab64
parentb2c90deab7f58eaf0efb38e22d8fec3e05002ec8 (diff)
downloadlibaio-a4984400f1d40c3cd9353ee2d817271c0fa3b4bd.tar.gz
this should make ia64 libaio syscalls work
-rw-r--r--src/compat-0_1.c15
-rw-r--r--src/io_cancel.c6
-rw-r--r--src/io_destroy.c5
-rw-r--r--src/io_getevents.c5
-rw-r--r--src/io_setup.c5
-rw-r--r--src/io_submit.c5
-rw-r--r--src/libaio.map8
-rw-r--r--src/syscall-ia64.h62
-rw-r--r--src/syscall.h13
9 files changed, 60 insertions, 64 deletions
diff --git a/src/compat-0_1.c b/src/compat-0_1.c
index d9576ec..9103658 100644
--- a/src/compat-0_1.c
+++ b/src/compat-0_1.c
@@ -27,11 +27,6 @@
#include "syscall.h"
-static inline int real_sys_io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *event)
-{
- return syscall3(__NR_io_cancel, ctx, iocb, event);
-}
-
/* ABI change. Provide partial compatibility on this one for now. */
SYMVER(compat0_1_io_cancel, io_cancel, 0.1);
int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb)
@@ -39,7 +34,7 @@ int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb)
struct io_event event;
/* FIXME: the old ABI would return the event on the completion queue */
- return real_sys_io_cancel(ctx, iocb, &event);
+ return io_cancel(ctx, iocb, &event);
}
SYMVER(compat0_1_io_wait, io_wait, 0.1);
@@ -50,12 +45,6 @@ int compat0_1_io_wait(io_context_t ctx, struct iocb *iocb, const struct timespec
/* ABI change. Provide backwards compatibility for this one. */
-static inline long real_sys_io_getevents(io_context_t ctx_id, long min_nr,
- long nr, struct io_event *events, struct timespec *timeout)
-{
- return syscall5(__NR_io_getevents, ctx_id, min_nr, nr, events, timeout);
-}
-
SYMVER(compat0_1_io_getevents, io_getevents, 0.1);
int compat0_1_io_getevents(io_context_t ctx_id, long nr,
struct io_event *events,
@@ -64,7 +53,7 @@ int compat0_1_io_getevents(io_context_t ctx_id, long nr,
struct timespec timeout;
if (const_timeout)
timeout = *const_timeout;
- return real_sys_io_getevents(ctx_id, 1, nr, events,
+ return io_getevents(ctx_id, 1, nr, events,
const_timeout ? &timeout : NULL);
}
diff --git a/src/io_cancel.c b/src/io_cancel.c
index ed5fb54..108a264 100644
--- a/src/io_cancel.c
+++ b/src/io_cancel.c
@@ -19,7 +19,5 @@
#include <libaio.h>
#include "syscall.h"
-int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *event)
-{
- return syscall3(__NR_io_cancel, ctx, iocb, event);
-}
+io_syscall3(int, io_cancel, io_context_t, ctx, struct iocb *, iocb, struct io_event *, event)
+
diff --git a/src/io_destroy.c b/src/io_destroy.c
index 99f8bf9..1f231a8 100644
--- a/src/io_destroy.c
+++ b/src/io_destroy.c
@@ -20,7 +20,4 @@
#include <libaio.h>
#include "syscall.h"
-int io_destroy(io_context_t ctx)
-{
- return syscall1(__NR_io_destroy, ctx);
-}
+io_syscall1(int, io_destroy, io_context_t, ctx)
diff --git a/src/io_getevents.c b/src/io_getevents.c
index cc5de6d..aae2261 100644
--- a/src/io_getevents.c
+++ b/src/io_getevents.c
@@ -22,7 +22,4 @@
#include <time.h>
#include "syscall.h"
-int io_getevents(io_context_t ctx, long min_nr, long nr, struct io_event *events, struct timespec *timeout)
-{
- return syscall5(__NR_io_getevents, ctx, min_nr, nr, events, timeout);
-}
+io_syscall5(int, io_getevents, io_context_t, ctx, long, min_nr, long, nr, struct io_event *, events, struct timespec *, timeout)
diff --git a/src/io_setup.c b/src/io_setup.c
index a2d3788..031f7f0 100644
--- a/src/io_setup.c
+++ b/src/io_setup.c
@@ -20,7 +20,4 @@
#include <libaio.h>
#include "syscall.h"
-int io_setup(int maxevents, io_context_t *ctxp)
-{
- return syscall2(__NR_io_setup, maxevents, ctxp);
-}
+io_syscall2(int, io_setup, int, maxevents, io_context_t *, ctxp)
diff --git a/src/io_submit.c b/src/io_submit.c
index 18efb0e..c7606f0 100644
--- a/src/io_submit.c
+++ b/src/io_submit.c
@@ -20,7 +20,4 @@
#include <libaio.h>
#include "syscall.h"
-int io_submit(io_context_t ctx, long nr, struct iocb **iocbs)
-{
- return syscall3(__NR_io_submit, ctx, nr, iocbs);
-}
+io_syscall3(int, io_submit, io_context_t, ctx, long, nr, struct iocb **, iocbs)
diff --git a/src/libaio.map b/src/libaio.map
index c491c16..27d8ba3 100644
--- a/src/libaio.map
+++ b/src/libaio.map
@@ -4,8 +4,16 @@ LIBAIO_0.4 {
io_destroy;
io_cancel;
io_getevents;
+
+ # these are compatible with 0.1
+ io_queue_init;
+ io_queue_run;
+ io_queue_wait;
+ io_queue_release;
+ io_submit;
local:
*;
+
};
LIBAIO_0.1 {
diff --git a/src/syscall-ia64.h b/src/syscall-ia64.h
index a159a9c..c590547 100644
--- a/src/syscall-ia64.h
+++ b/src/syscall-ia64.h
@@ -1,30 +1,44 @@
-#define __NR_io_setup 1025 //1238
+#define __NR_io_setup 1238
#define __NR_io_destroy 1239
#define __NR_io_getevents 1240
#define __NR_io_submit 1241
#define __NR_io_cancel 1242
-extern long __ia64_aio_raw_syscall(long a, long b, long c, long d, long e, long nr);
-#if 0
-static long __ia64_raw_syscall(nr, a, b, c, d, e)
-{
- long dummy aa, bb, cc, dd, ee;
-
- __asm__("break __BREAK_SYSCALL\n"
- ";;\n"
- "1:\n"
- : "out0" (aa),
- "out1" (bb),
- "out2" (cc),
- "out3" (dd),
- "out4" (ee),
- "out5" (ff))
-}
-#endif
-
-#define syscall5(nr, a, b, c, d, e) __ia64_aio_raw_syscall(a, b, c, d, e, nr)
-#define syscall4(nr, a, b, c, d) syscall5(nr, a, b, c, d, 0)
-#define syscall3(nr, a, b, c) syscall4(nr, a, b, c, 0)
-#define syscall2(nr, a, b) syscall3(nr, a, b, 0)
-#define syscall1(nr, a) syscall2(nr, a, 0)
+#define __ia64_raw_syscall(name) \
+ __asm__ (".text\n" \
+ ".globl " SYMSTR(name) "\n" \
+ SYMSTR(name) ":\n" \
+ " mov r15=" SYMSTR( __NR_ ## name ) "\n" \
+ " break 0x100000\n" \
+ " ;;\n" \
+ " (p6) sub r8=0,r8\n" \
+ " br.ret.sptk.few b0\n" \
+ ".size " SYMSTR(name) ", . - " SYMSTR(name) "\n" \
+ ".endp " SYMSTR(name) "\n" \
+ );
+
+#define io_syscall0(type, name) \
+ extern type name(void); \
+ __ia64_raw_syscall(name);
+
+#define io_syscall1(type, name, type1, arg1) \
+ extern type name(type1 arg1); \
+ __ia64_raw_syscall(name);
+
+#define io_syscall2(type, name, type1, arg1, type2, arg2) \
+ extern type name(type1 arg1, type2 arg2); \
+ __ia64_raw_syscall(name);
+
+#define io_syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \
+ extern type name(type1 arg1, type2 arg2, type3 arg3); \
+ __ia64_raw_syscall(name);
+
+#define io_syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
+ extern type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4); \
+ __ia64_raw_syscall(name);
+
+#define io_syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \
+ extern type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5); \
+ __ia64_raw_syscall(name);
+
diff --git a/src/syscall.h b/src/syscall.h
index 7ca2cd5..993b6b2 100644
--- a/src/syscall.h
+++ b/src/syscall.h
@@ -1,3 +1,9 @@
+#define _SYMSTR(str) #str
+#define SYMSTR(str) _SYMSTR(str)
+
+#define SYMVER(compat_sym, orig_sym, ver_sym) \
+ __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
+
#if defined(__i386__)
#include "syscall-i386.h"
#elif defined(__ia64__)
@@ -6,10 +12,3 @@
#error "add syscall-arch.h"
#endif
-#define _SYMSTR(str) #str
-#define SYMSTR(str) _SYMSTR(str)
-
-#define SYMVER(compat_sym, orig_sym, ver_sym) \
- __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
-
-