[PATCH] Consolidate Linux readahead() implementations

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Sep 22 21:26:00 GMT 2016



On 22/09/2016 17:59, Dmitry V. Levin wrote:
> On Thu, Sep 22, 2016 at 11:44:28PM +0300, Yury Norov wrote:
>> All Linux users pass 4 arguments to readahead() except arm and mips.
> 
> That's odd because 64-bit kernels take only 3 arguments, and powerpc takes 5.
> 
> 

Yes, it is because powerpc and 64-bits kernels syscalls wrappers are
generated by syscalls.list instead of C implementations.  On powerpc
it is generated by:

(echo '#define SYSCALL_NAME readahead'; \
 echo '#define SYSCALL_NARGS 5'; \
 echo '#define SYSCALL_SYMBOL __readahead'; \
 echo '#define SYSCALL_CANCELLABLE 0'; \
 echo '#define SYSCALL_NOERRNO 0'; \
 echo '#define SYSCALL_ERRVAL 0'; \
 echo '#include <syscall-template.S>'; \
 echo 'weak_alias (__readahead, readahead)'; \
 echo 'hidden_weak (readahead)'; \
...)

While on x86_64 it is:

(echo '#define SYSCALL_NAME readahead'; \
 echo '#define SYSCALL_NARGS 3'; \
 echo '#define SYSCALL_SYMBOL __readahead'; \
 echo '#define SYSCALL_CANCELLABLE 0'; \
 echo '#define SYSCALL_NOERRNO 0'; \
 echo '#define SYSCALL_ERRVAL 0'; \
 echo '#include <syscall-template.S>'; \
 echo 'weak_alias (__readahead, readahead)'; \
 echo 'hidden_weak (readahead)'; \

The 4 argument is only for 32-bit ABI the passes 64-bit arguments
in 2 registers.



More information about the Libc-alpha mailing list