[OpenBIOS] [RFC 2/3] PPC: Mimic Apple's OpenFirmware behaviour if a divide by zero occurs.
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Mon Jan 7 16:07:40 CET 2013
As reported by Amadeusz Sławiński using a real Mac, if anything is divided by
zero then we should return zero:
0 > 2 0 / ok
1 > u. 0 ok
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
openbios-devel/arch/ppc/ppc.fs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/openbios-devel/arch/ppc/ppc.fs b/openbios-devel/arch/ppc/ppc.fs
index 6995ba9..212894d 100644
--- a/openbios-devel/arch/ppc/ppc.fs
+++ b/openbios-devel/arch/ppc/ppc.fs
@@ -53,5 +53,12 @@
\ other
\ -------------------------------------------------------------------------
+\ Override divide by zero handling
+\ Tests indicate that Apple's OF implementation returns a single value of 0
+
+: (ppc-div-by-zero-handler) 3drop 0 0 0 ;
+
+['] (ppc-div-by-zero-handler) to (div-by-zero-handler)
+
\ Set by BootX when booting Mac OS X
defer spin
--
1.7.10.4
More information about the OpenBIOS
mailing list