[OpenBIOS] [commit] r733 - trunk/openbios-devel/libopenbios

Tarl Neustaedter tarl-b2 at tarl.net
Sat Apr 3 17:55:28 CEST 2010


On 2010-4-3 11:21 AM, Segher Boessenkool wrote:
>> + /* Some clients request less parameters than the CIF method
>> + returns, e.g. getprop with OpenSolaris.
>
> Really? getprop has only one return value, and it is essential to 
> check it!
> Well, maybe they always call getproplen before. [...]

I have a vague recollection that for historical reasons that's exactly 
what Solaris does. Something about non-terminated null strings if the 
property was too large for the buffer (the size returned in getprop is 
the min of buffer size and property size). Buried in the mists of 
antiquity, back in the days when it wasn't unusual to have the kernel 
fall over doing a printf() of a too-long string.

> But it's always an error to have the number of return values (or 
> arguments) not match with what is required.

Oh, it's certainly the wrong thing to do, and when writing new code you 
should avoid it. But evidently there is existing code which does it. 
Since the interface allows specifying fewer requested return values, we 
have to handle the case where they aren't asked for.

I should note that there is some commentary in section 6.3.1 of 1275 
which explains the additional return value pushed by client-call-iface:

/In addition to the ret1 through retN values that are returned in the 
array, the client interface handler returns a single value as specified 
in the Open Firmware supplement for the appropriate ISA (see 2.1). That 
value indicates whether the transfer of control to the Open Firmware 
succeeded or failed. If the requested service is unavailable or if the 
control transfer failed, the client interface handler returns the value 
–1; otherwise, it returns the value zero./




More information about the OpenBIOS mailing list