Author: mcayland Date: Mon Dec 1 21:52:15 2014 New Revision: 1328 URL: http://tracker.coreboot.org/trac/openbios/changeset/1328
Log: package.fs: fix "child" word being called with a NULL phandle
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
Modified: trunk/openbios-devel/forth/device/package.fs
Modified: trunk/openbios-devel/forth/device/package.fs ============================================================================== --- trunk/openbios-devel/forth/device/package.fs Fri Nov 14 20:17:48 2014 (r1327) +++ trunk/openbios-devel/forth/device/package.fs Mon Dec 1 21:52:15 2014 (r1328) @@ -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 @
;