Regarding select() on PPC

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Sep 24 17:08:50 EST 2008


On Wed, 2008-09-24 at 08:45 +0200, Arnd Bergmann wrote:
> On Wednesday 24 September 2008, Benjamin Herrenschmidt wrote:
> > Why do we want it ?
> > 
> > It's an int, it's zero extended, but that should still be a valid signed
> > 32 bits int in compat_sys_select() or do I miss something ?
> 
> IIRC, the calling conventions on 64 bit ppc assume that a signed int
> argument is sign-extended into a 64 bit register. The compat syscall
> entry point does not know which registers are signed or unsigned, so
> it will always to zero-extend, making the register contain an undefined
> bit pattern (e.g. 0x00000000fffffffe), which may be interpreted as being
> a positive number. An explicit cast as it is done in ppc32_select turns
> this into a well-defined 32-bit number stored in a 64-bit register (e.g.
> 0xfffffffffffffffe).

If that is true, then _any_ syscall that takes an int value must have
a ppc specific sign-extending compat wrapper, are you sure that is
the case ?

Ben.




More information about the Linuxppc-embedded mailing list