Requires mini.
Copyright (C) 2008 Segher Boessenkool <segher@kernel.crashing.org>
+Copyright (C) 2009 Bernhard Urban <lewurm@gmx.net>
+Copyright (C) 2009 Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
# 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
#include "string.h"
#include "irq.h"
+#include "hollywood.h"
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;
-
- _CPU_ISR_Disable(cookie);
- printf("\nInterrupt occured ;-) Which one? -> ");
- u32 enabled = read32(BW_PI_IRQMASK);
- u32 flags = read32(BW_PI_IRQFLAG);
- flags = flags & enabled;
- if (flags & (1<<1)) { // RESET
- write32(BW_PI_IRQFLAG, 1<<1);
- printf("RESET :)\n");
- }
- if (flags & (1<<14)) { // Hollywood-PIC IRQ
- write32(BW_PI_IRQFLAG, 1<<14);
- write32(HW_PPCIRQFLAG, ~0); // dirty
- printf("Hollywood-PIC :)\n");
- }
- _CPU_ISR_Restore(cookie);
+ irq_handler();
+ }
- return;
+ // check if exception happened due to the decrementer
+ else if (exception == 0x900) {
+ //printf("\nDecrementer exception occured - who cares?\n");
}
- 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 (;;)
- ;
+ irq_restore(cookie);
}
void exception_init(void)