the whitespace hunter has struck again!
[ppcskel.git] / exception.c
index f439b149428386c03b14ae53a388526cfe4fa377..4362569f21d06032e5762952e525759c98ac0b66 100644 (file)
@@ -18,37 +18,44 @@ extern char exception_2200_start, exception_2200_end;
 
 void exception_handler(int exception)
 {
-       // check if the exception was actually an interrupt
+       u32 cookie = irq_kill();
+       // check if the exception was actually an external interrupt
        if (exception == 0x500) {
-               u32 cookie = irq_kill();
                irq_handler();
-               irq_restore(cookie);
-               return;
        }
 
-       u32 *x;
-       u32 i;
+       // check if exception happened due to the decrementer
+       else if (exception == 0x900) {
+               printf("\nDecrementer exception occured - who cares?\n");
+       }
 
-       printf("\nException %04x occurred!\n", exception);
+       else {
+               u32 *x;
+               u32 i;
 
-       x = (u32 *)0x80002000;
+               printf("\nException %04X occurred!\n", exception);
 
-       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;
+               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)