[OpenBIOS] [RFC 3/3] SPARC32/64: Mimic Sun's OBP behaviour if a divide by zero occurs.

Artyom Tarasenko atar4qemu at gmail.com
Mon Jan 7 17:47:00 CET 2013


Hi Mark,

On Mon, Jan 7, 2013 at 4:07 PM, Mark Cave-Ayland
<mark.cave-ayland at ilande.co.uk> wrote:
> As reported by Artyom Tarasenko, if anything is divided by zero then we should
> return no value:
>
> 0 > 4 2 / u. 2  ok
> 0 > 2 0 /  ok

NAK. Either my memory is cheating on me or there is some other Artyom
Tarasenko who reported it. OBP produces an exception in case of
division by zero.

(This time adding you to cc, since the mailing list bounces my mails
saying my emai is graylisted - whatever it means).

>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
> ---
>  openbios-devel/arch/sparc32/init.fs |    7 +++++++
>  openbios-devel/arch/sparc64/init.fs |    7 +++++++
>  2 files changed, 14 insertions(+)
>
> diff --git a/openbios-devel/arch/sparc32/init.fs b/openbios-devel/arch/sparc32/init.fs
> index 7306eab..7d20d4d 100644
> --- a/openbios-devel/arch/sparc32/init.fs
> +++ b/openbios-devel/arch/sparc32/init.fs
> @@ -45,3 +45,10 @@ device-end
>  : obmem ( -- space )
>    0
>    ;
> +
> +\ Override divide by zero handling
> +\ Tests indicate that Sun's OBP implementation returns no value in this case
> +
> +: (sparc-div-by-zero-handler) 3drop 0 0 ;
> +
> +['] (sparc-div-by-zero-handler) to (div-by-zero-handler)
> diff --git a/openbios-devel/arch/sparc64/init.fs b/openbios-devel/arch/sparc64/init.fs
> index a1cadc1..535b7d2 100644
> --- a/openbios-devel/arch/sparc64/init.fs
> +++ b/openbios-devel/arch/sparc64/init.fs
> @@ -53,3 +53,10 @@ device-end
>  : rmap@    ( virt -- rmentry )
>    drop 0
>    ;
> +
> +\ Override divide by zero handling
> +\ Tests indicate that Sun's OBP implementation returns no value in this case
> +
> +: (sparc-div-by-zero-handler) 3drop 0 0 ;
> +
> +['] (sparc-div-by-zero-handler) to (div-by-zero-handler)
> --
> 1.7.10.4
>
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you



-- 
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/search/label/qemu



More information about the OpenBIOS mailing list