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