[OpenBIOS] [PATCH] ppc: Increase #address-cells for ppc64

Tarl Neustaedter tarl-b2 at tarl.net
Sun Nov 28 00:19:11 CET 2010


On 2010-11-27 6:01 PM, Andreas Färber wrote:
> [...]
> I applied a reworked version in r975, with the PUSH() logic in an inline 
> function.
>
> As mentioned in the commit message, what I failed with was a loop along the 
> lines of:
>
> while (remaining > 0) {
> PUSH(value);
> remaining -= sizeof(ucell);
> value >>= (sizeof(ucell) * 8);
> }
>
> That shift compiles only if sizeof(phys_addr_t) > sizeof(ucell), i.e. on ppc64.

That loop seems somewhat overkill, given that sizeof() phys_addr_t and ucell 
are going to be either 4 or 8. I'd think it would be easier to check for 
equality to do a single PUSH, otherwise check to make sure two PUSHes will 
work. (We don't support 16-bit ucells any more, do we?)

Something like:

if (sizeof(ucell) >= sizeof(phys_addr_t))
     PUSH(value);
else {
     PUSH(value);
     PUSH(value >> (sizeof(ucell) * 8));
}




More information about the OpenBIOS mailing list