From 34c539fcb98c4397b9f04e93f8a475a9e445cf33 Mon Sep 17 00:00:00 2001 From: Ben LaHaise Date: Fri, 13 Sep 2002 03:30:12 +0000 Subject: more libaio cleanups for ia64 --- src/Makefile | 4 ++++ src/io_destroy.c | 26 ++++++++++++++++++++++++++ src/io_queue_release.c | 1 - src/io_queue_run.c | 3 +-- src/io_queue_wait.c | 4 +--- src/io_setup.c | 26 ++++++++++++++++++++++++++ src/libaio.map | 2 ++ src/raw_syscall.c | 18 ++++++++++++++++++ src/syscall-ia64.h | 22 ++++++++++++++++++++-- 9 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 src/io_destroy.c create mode 100644 src/io_setup.c create mode 100644 src/raw_syscall.c diff --git a/src/Makefile b/src/Makefile index 29b03dd..4a86b4d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,6 +18,10 @@ libaio_srcs += io_queue_wait.c io_queue_run.c # real syscalls libaio_srcs += io_getevents.c io_submit.c io_cancel.c +libaio_srcs += io_setup.c io_destroy.c + +# internal functions +libaio_srcs += raw_syscall.c # old symbols libaio_srcs += compat-0_1.c diff --git a/src/io_destroy.c b/src/io_destroy.c new file mode 100644 index 0000000..99f8bf9 --- /dev/null +++ b/src/io_destroy.c @@ -0,0 +1,26 @@ +/* io_destroy + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include +#include "syscall.h" + +int io_destroy(io_context_t ctx) +{ + return syscall1(__NR_io_destroy, ctx); +} diff --git a/src/io_queue_release.c b/src/io_queue_release.c index afa57fe..94bbb86 100644 --- a/src/io_queue_release.c +++ b/src/io_queue_release.c @@ -20,7 +20,6 @@ #include #include #include -#include "vsys_def.h" int io_queue_release(io_context_t ctx) { diff --git a/src/io_queue_run.c b/src/io_queue_run.c index 255392f..83f8f2a 100644 --- a/src/io_queue_run.c +++ b/src/io_queue_run.c @@ -20,7 +20,6 @@ #include #include #include -#include "vsys_def.h" int io_queue_run(io_context_t ctx) { @@ -29,7 +28,7 @@ int io_queue_run(io_context_t ctx) int ret; /* FIXME: batch requests? */ - while (1 == (ret = vsys_io_getevents(ctx, 1, &event, &timeout))) { + while (1 == (ret = io_getevents(ctx, 0, 1, &event, &timeout))) { io_callback_t cb = (io_callback_t)event.data; struct iocb *iocb = (struct iocb *)event.obj; diff --git a/src/io_queue_wait.c b/src/io_queue_wait.c index a39bc47..a6e0bec 100644 --- a/src/io_queue_wait.c +++ b/src/io_queue_wait.c @@ -21,11 +21,9 @@ #include #include -#include "vsys_def.h" - struct timespec; int io_queue_wait(io_context_t ctx, struct timespec *timeout) { - return vsys_io_getevents(ctx, 0, NULL, timeout); + return io_getevents(ctx, 0, 0, NULL, timeout); } diff --git a/src/io_setup.c b/src/io_setup.c new file mode 100644 index 0000000..a2d3788 --- /dev/null +++ b/src/io_setup.c @@ -0,0 +1,26 @@ +/* io_setup + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include +#include "syscall.h" + +int io_setup(int maxevents, io_context_t *ctxp) +{ + return syscall2(__NR_io_setup, maxevents, ctxp); +} diff --git a/src/libaio.map b/src/libaio.map index 480fbf8..c491c16 100644 --- a/src/libaio.map +++ b/src/libaio.map @@ -1,5 +1,7 @@ LIBAIO_0.4 { global: + io_setup; + io_destroy; io_cancel; io_getevents; local: diff --git a/src/raw_syscall.c b/src/raw_syscall.c new file mode 100644 index 0000000..3c8d7fa --- /dev/null +++ b/src/raw_syscall.c @@ -0,0 +1,18 @@ +#include "syscall.h" + +#if defined(__ia64__) +/* based on code from glibc by Jes Sorensen */ +__asm__(".text\n" + ".globl __ia64_aio_raw_syscall\n" + "__ia64_aio_raw_syscall:\n" + "alloc r2=ar.pfs,1,0,8,0\n" + "mov r15=r32\n" + "break 0x100000\n" + ";;" + "br.ret.sptk.few b0\n" + ".size __ia64_aio_raw_syscall, . - __ia64_aio_raw_syscall\n" + ".endp __ia64_aio_raw_syscall" +); +#endif + +; diff --git a/src/syscall-ia64.h b/src/syscall-ia64.h index a7edd79..a159a9c 100644 --- a/src/syscall-ia64.h +++ b/src/syscall-ia64.h @@ -1,10 +1,28 @@ -#define __NR_io_setup 1238 +#define __NR_io_setup 1025 //1238 #define __NR_io_destroy 1239 #define __NR_io_getevents 1240 #define __NR_io_submit 1241 #define __NR_io_cancel 1242 -#define syscall5(nr, a, b, c, d, e) __ia64_raw_syscall(nr, a, b, c, d, e) +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) -- cgit v1.2.1