Re: 64-syscall args on 32-bit vs syscall()

From: Benjamin Herrenschmidt
Date: Mon Mar 15 2010 - 16:28:11 EST


On Mon, 2010-03-15 at 14:44 +0100, Ralf Baechle wrote:
> Syscall is most often used for new syscalls that have no syscall stub in
> glibc yet, so the user of syscall() encodes this ABI knowledge. If at a
> later stage syscall() is changed to have this sort of knowledge we break
> the API. This is something only the kernel can get right.

Well, no. The change I propose would not break the ABI on powerpc and
would auto-magically fix thoses cases :-) But again, you don't have to
do the same thing on MIPS or sparc, it's definitely arch specific.

IE. What you are saying is that a syscall defined in the kernel as:

sys_foo(u64 arg);

To be called from userspace would require something like:

u64 arg = 0x123456789abcdef01;

#if defined(__powerpc__) && WORDSIZE == 32
syscall(SYS_foo, (u32)(arg >> 32), (u32)arg);
#ese
syscall(SYS_foo, arg);

While with the trick of making syscall a macro wrapping an underlying
__syscall that has an added dummy argument, the register alignment is
"corrected" and thus -both- forms above suddenly work for me. That might
actually work for you too.

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/