[RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Apr 23 11:32:00 GMT 2018
On 08/04/2018 04:02, Mao Han wrote:
> diff --git a/sysdeps/unix/sysv/linux/csky/ftruncate64.c b/sysdeps/unix/sysv/linux/csky/ftruncate64.c
> new file mode 100644
> index 0000000..47c38e6
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/ftruncate64.c
> @@ -0,0 +1,41 @@
> +/* Truncate the file FD refers to to LENGTH bytes. */
> +int
> +__ftruncate64 (int fd, off64_t length)
> +{
> + unsigned int low = length & 0xffffffff;
> + unsigned int high = length >> 32;
> +#ifdef __CSKYABIV2__
> + int result = INLINE_SYSCALL (ftruncate64, 3, fd,
> + __LONG_LONG_PAIR (high, low));
> +#else
> + int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
> + __LONG_LONG_PAIR (high, low));
> +#endif
> + return result;
> +}
> +weak_alias (__ftruncate64, ftruncate64)
If I understand correctly the ABIv1 requires oven register for 64 bit argument
passing, which is represented inside glibc as __ASSUME_ALIGNED_REGISTER_PAIRS
set to 1. So setting it correctly for ABIv1 should make it possible to use
the generic 'sysdeps/unix/sysv/linux/ftruncate64.c' for c-sky.
> diff --git a/sysdeps/unix/sysv/linux/csky/readahead.c b/sysdeps/unix/sysv/linux/csky/readahead.c
> new file mode 100644
> index 0000000..255361c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/readahead.c
> @@ -0,0 +1,34 @@
> +
> +ssize_t
> +__readahead (int fd, off64_t offset, size_t count)
> +{
> + return INLINE_SYSCALL_CALL (readahead, fd,
> + __ALIGNMENT_ARG SYSCALL_LL64 (offset), count);
> +}
> +
> +weak_alias (__readahead, readahead)
I just sent a patch to consolidate Linux readahead implementation [1]. So most
likely this new arch-specific file for c-sky would be unnecessary.
> diff --git a/sysdeps/unix/sysv/linux/csky/scandir64.c b/sysdeps/unix/sysv/linux/csky/scandir64.c
> new file mode 100644
> index 0000000..506fd88
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/scandir64.c
> @@ -0,0 +1 @@
> +#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
The 'scandir{at}{64}' consolidation is pushed upstream [2], so this file should
be unnecessary as well.
[1] https://sourceware.org/ml/libc-alpha/2018-04/msg00471.html
[2] https://sourceware.org/git/?p=glibc.git;a=commit;h=c0123b3b1118419210879e935620eb2ad987c2f1
More information about the Libc-alpha
mailing list