libc: Add ftruncate64 and improve 64-bit parameter syscall handling.
This patch improves the handling of 64-bit parameters in syscalls on ARM.
The ARM EABI mandates that 64-bit quantities be passed in even/odd register
pairs, which requires special treatment.
This allows us to simplify our implementations of pread() and pwrite()
and remove the C stubs for pread64() and pwrite64().
Also add ftruncate64() to <unistd.h>
Change-Id: I407e2fd223ba0093dd2d0b04c6152fadfc9ce3ef
Bug 3107933
diff --git a/libc/arch-sh/syscalls/pwrite64.S b/libc/arch-sh/syscalls/pwrite64.S
new file mode 100644
index 0000000..3f6c192
--- /dev/null
+++ b/libc/arch-sh/syscalls/pwrite64.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type pwrite64, @function
+ .globl pwrite64
+ .align 4
+
+pwrite64:
+
+ /* get ready for additonal arg */
+ mov.l @r15, r0
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(5 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_pwrite64_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_pwrite64_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_pwrite64
+1: .long __set_syscall_errno