[RFCv3] PPC: Mimic Apple's OpenFirmware behaviour if a divide by zero occurs.

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 This resolves a bug in BootX which (un)intentionally divides by zero during boot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> --- openbios-devel/arch/ppc/qemu/init.c | 8 ++++++++ openbios-devel/arch/ppc/qemu/start.S | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/openbios-devel/arch/ppc/qemu/init.c b/openbios-devel/arch/ppc/qemu/init.c index dfc201f..a8fc320 100644 --- a/openbios-devel/arch/ppc/qemu/init.c +++ b/openbios-devel/arch/ppc/qemu/init.c @@ -59,6 +59,14 @@ unexpected_excep(int vector) } } +extern void __divide_error(void); + +void +__divide_error(void) +{ + return; +} + enum { ARCH_PREP = 0, ARCH_MAC99, diff --git a/openbios-devel/arch/ppc/qemu/start.S b/openbios-devel/arch/ppc/qemu/start.S index 77ced18..5c86d74 100644 --- a/openbios-devel/arch/ppc/qemu/start.S +++ b/openbios-devel/arch/ppc/qemu/start.S @@ -295,7 +295,6 @@ call_isi_exception: exception_return: EXCEPTION_EPILOGUE -_GLOBAL(__divide_error): trap_error: mflr r3 LOAD_REG_FUNC(r4, unexpected_excep) -- 1.7.10.4
participants (1)
-
Mark Cave-Ayland