This is the mail archive of the
mailing list for the glibc project.
Re: PATCH: Add LOAD_ARG[1-6]_TYPE and x32 posix_fallocate.c
On Mon, May 21, 2012 at 2:02 PM, Roland McGrath <firstname.lastname@example.org> wrote:
> That is inordinately ugly.
> AFAICT the existing x86_64 behavior for a syscall argument of a
> smaller integer type (e.g. int, i.e. int32_t) is to sign-extend that
> value to 64 bits in the syscall argument register. ?So what would be
> the practical effect of just making LOAD_ARGS* just use 'long long
> int' throughout? ?It won't make any difference to x86_64, and for x32
> it will just sign-extend any signed smaller-typed values (and make no
> difference for unsigned types). ?I think if you actually make it
> 'unsigned long long int' then that will correctly sign-extend int32_t
> (and smaller integer types) but zero-extend pointer types.
For int32_t, it makes no difference between unsigned long long int
and long long int for both x32 and x86-64 since kernel access it
as int32_t. The only problem is off_t, which is int64_t for both
x32 and x86-64. Again, it makes no difference between
unsigned long long int and long long int for both x32 and x86-64.
There are no other system calls in C which has int64_t for
arguments. For those system calls which take uint64_t,
long is fine for x32 since casting from unsigned long to long
will zero-extend to uint64.
So using 'unsigned long long int' isn't necessary for neither
x32 nor x86-64.