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
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@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)