[OpenBIOS] input length

Tarl Neustaedter Tarl.Neustaedter at Sun.COM
Tue Mar 23 18:10:31 CET 2010

> It looks like all the keywords are known to the OpenBIOS, but I can't
> input the test string:
> " /options" ['] find-device catch if 2drop true else current-device
> device-end then swap l!

The above executed at the command line will get you in trouble - it's 
expecting arguments on the stack you don't have.

" /options" ['] find-device catch

This finds the "/options" node in the device tree and makes it the active device context. The top argument on the stack will tell you whether find-device caused a problem (aborted).

if 2drop true else current-device device-end then

The above says to drop two arguments from the stack (hopefully the string "/options") if find-device aborted, otherwise get the phandle of "/options" and put it on the stack. The device-end destroys the device context of /options. I'm not sure why this code does this, a simpler way would have been to simply call find-package, which doesn't set your device context in the first place.

swap l!

The above depends on something else being on the stack, telling you 
where to store the /options phandle.

More information about the OpenBIOS mailing list