This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Add x32 preadv/pwritev
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 17 May 2012 04:56:09 -0700
- Subject: PATCH: Add x32 preadv/pwritev
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
Here is another patch to properly load int64 arguments. Tested on
Linux/x32. OK to install?
Thanks.
H.J.
----
* sysdeps/unix/sysv/linux/x86_64/x32/preadv.c: New file.
* sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c: Likewise.
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/preadv.c b/sysdeps/unix/sysv/linux/x86_64/x32/preadv.c
new file mode 100644
index 0000000..4e250e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/preadv.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sysdep.h>
+#define preadv64 __redirect_preadv64
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+#undef LOAD_ARGS_4
+#define LOAD_ARGS_4(a1, a2, a3, a4) \
+ long long int __arg4 = (long long int) (a4); \
+ LOAD_ARGS_3 (a1, a2, a3)
+#undef LOAD_REGS_4
+#define LOAD_REGS_4 \
+ register long long int _a4 asm ("r10") = __arg4; \
+ LOAD_REGS_3
+
+ssize_t
+preadv (int fd, const struct iovec *vector, int count, off_t offset)
+{
+ ssize_t result;
+ if (SINGLE_THREAD_P)
+ result = INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ result = INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
+ LIBC_CANCEL_RESET (oldtype);
+ }
+ return result;
+}
+#undef preadv64
+strong_alias (preadv, preadv64)
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c b/sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c
new file mode 100644
index 0000000..3f5feb2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sysdep.h>
+/* Hide the pwritev64 declaration. */
+#define pwritev64 __redirect_pwritev64
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+#undef LOAD_ARGS_4
+#define LOAD_ARGS_4(a1, a2, a3, a4) \
+ long long int __arg4 = (long long int) (a4); \
+ LOAD_ARGS_3 (a1, a2, a3)
+#undef LOAD_REGS_4
+#define LOAD_REGS_4 \
+ register long long int _a4 asm ("r10") = __arg4; \
+ LOAD_REGS_3
+
+ssize_t
+pwritev (int fd, const struct iovec *vector, int count, off_t offset)
+{
+ ssize_t result;
+ if (SINGLE_THREAD_P)
+ result = INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ result = INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
+ LIBC_CANCEL_RESET (oldtype);
+ }
+ return result;
+}
+#undef pwritev64
+strong_alias (pwritev, pwritev64)