Subject: Re: Regarding select() on PPC

From: Arnd Bergmann <[email-masked]>
Date: Wed, 24 Sep 2008 08:45:51 +0200

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).

	Arnd <><