Solaris 9 relies on an undocumented feature that calling "child" with a NULL phandle is equivalent to using the phandle of the device tree root node.
Make sure that we emulate the same behaviour to avoid a crash when dereferencing a NULL pointer.
This patch fixes Solaris 9 boot on SPARC32 and is based upon a proof-of-concept patch submitted by Artyom Tarasenko atar4qemu@gmail.com.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/forth/device/package.fs | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/openbios-devel/forth/device/package.fs b/openbios-devel/forth/device/package.fs index eb17551..d5b52c3 100644 --- a/openbios-devel/forth/device/package.fs +++ b/openbios-devel/forth/device/package.fs @@ -49,6 +49,10 @@ ;
: child ( phandle.parent -- phandle.child ) + \ Assume phandle == 0 indicates root node (not documented but similar + \ behaviour to "peer"). Used by some versions of Solaris (e.g. 9). + ?dup if else device-tree @ then +
dn.child @
;