Author: mcayland Date: Sun Jan 13 16:26:53 2013 New Revision: 1087 URL: http://tracker.coreboot.org/trac/openbios/changeset/1087
Log: 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 rather than invoke a manual trap:
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
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c trunk/openbios-devel/arch/ppc/qemu/start.S
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/init.c Sat Jan 12 18:22:39 2013 (r1086) +++ trunk/openbios-devel/arch/ppc/qemu/init.c Sun Jan 13 16:26:53 2013 (r1087) @@ -59,6 +59,14 @@ } }
+extern void __divide_error(void); + +void +__divide_error(void) +{ + return; +} + enum { ARCH_PREP = 0, ARCH_MAC99,
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/start.S Sat Jan 12 18:22:39 2013 (r1086) +++ trunk/openbios-devel/arch/ppc/qemu/start.S Sun Jan 13 16:26:53 2013 (r1087) @@ -295,7 +295,6 @@ exception_return: EXCEPTION_EPILOGUE
-_GLOBAL(__divide_error): trap_error: mflr r3 LOAD_REG_FUNC(r4, unexpected_excep)