[OpenBIOS] [PATCH] package.fs: fix "child" word being called with a NULL phandle

Artyom Tarasenko atar4qemu at gmail.com
Sun Nov 23 20:50:24 CET 2014


On Sun, Nov 23, 2014 at 4:29 PM, Mark Cave-Ayland
<mark.cave-ayland at ilande.co.uk> wrote:
> 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 at gmail.com>.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Tested it, works as good as the PoC patch, but is implemented in a
much more beautiful way, so

Acked-by: Artyom Tarasenko <atar4qemu at gmail.com>

> ---
>  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 @
>  ;
>
> --
> 1.7.10.4
>



-- 
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu



More information about the OpenBIOS mailing list