X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=ppcskel.git;a=blobdiff_plain;f=exception.c;h=f42b78be2da341bf1f7eeef5aa477967bc82394b;hp=095de44507780d28a82b3aed68c741d17f825036;hb=HEAD;hpb=42b71db72187cc5119caf2f06ab1a00333489249 diff --git a/exception.c b/exception.c index 095de44..f42b78b 100644 --- a/exception.c +++ b/exception.c @@ -3,6 +3,8 @@ Requires mini. Copyright (C) 2008 Segher Boessenkool +Copyright (C) 2009 Bernhard Urban +Copyright (C) 2009 Sebastian Falbesoner # This code is licensed to you under the terms of the GNU GPL, version 2; # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt @@ -11,34 +13,51 @@ Copyright (C) 2008 Segher Boessenkool #include "bootmii_ppc.h" #include "string.h" +#include "irq.h" +#include "hollywood.h" extern char exception_2200_start, exception_2200_end; void exception_handler(int exception) { - u32 *x; - u32 i; + u32 cookie = irq_kill(); + // check if the exception was actually an external interrupt + if (exception == 0x500) { + irq_handler(); + } - printf("\nException %04x occurred!\n", exception); + // check if exception happened due to the decrementer + else if (exception == 0x900) { + //printf("\nDecrementer exception occured - who cares?\n"); + } - x = (u32 *)0x80002000; + else { + u32 *x; + u32 i; - printf("\n R0..R7 R8..R15 R16..R23 R24..R31\n"); - for (i = 0; i < 8; i++) { - printf("%08x %08x %08x %08x\n", x[0], x[8], x[16], x[24]); - x++; - } - x = (u32 *)0x80002080; + printf("\nException %04X occurred!\n", exception); + + x = (u32 *)0x80002000; + + printf("\n R0..R7 R8..R15 R16..R23 R24..R31\n"); + for (i = 0; i < 8; i++) { + printf("%08x %08x %08x %08x\n", x[0], x[8], x[16], x[24]); + x++; + } + x = (u32 *)0x80002080; + + printf("\n CR/XER LR/CTR SRR0/SRR1 DAR/DSISR\n"); + for (i = 0; i < 2; i++) { + printf("%08x %08x %08x %08x\n", x[0], x[2], x[4], x[6]); + x++; + } - printf("\n CR/XER LR/CTR SRR0/SRR1 DAR/DSISR\n"); - for (i = 0; i < 2; i++) { - printf("%08x %08x %08x %08x\n", x[0], x[2], x[4], x[6]); - x++; + // Hang. + for (;;) + ; } - // Hang. - for (;;) - ; + irq_restore(cookie); } void exception_init(void)