]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - cpu/74xx_7xx/traps.c
Merge branch '080202_at91rm9200dk' of git://linux-arm.org/u-boot-armdev
[karo-tx-uboot.git] / cpu / 74xx_7xx / traps.c
index 26db0974025bb9bd5a873ed04b00e54f4c50ed52..b06622769699e66fdc45b36639fb4d9bd9424863 100644 (file)
 #include <command.h>
 #include <asm/processor.h>
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#ifdef CONFIG_AMIGAONEG3SE
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
+#if defined(CONFIG_CMD_KGDB)
 int (*debugger_exception_handler)(struct pt_regs *) = 0;
 #endif
 
@@ -45,7 +49,11 @@ extern unsigned long search_exception_table(unsigned long);
 
 /* THIS NEEDS CHANGING to use the board info structure.
 */
+#ifdef CONFIG_AMIGAONEG3SE
+#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
+#else
 #define END_OF_MEM     0x02000000
+#endif
 
 /*
  * Trap & Exception support
@@ -125,7 +133,7 @@ MachineCheckException(struct pt_regs *regs)
                return;
        }
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -133,19 +141,18 @@ MachineCheckException(struct pt_regs *regs)
        printf("Machine check in kernel mode.\n");
        printf("Caused by (from msr): ");
        printf("regs %p ",regs);
-       switch( regs->msr & 0x0000F000)
-       {
-       case (1<<12) :
+       switch( regs->msr & 0x000F0000) {
+       case (0x80000000>>12):
                printf("Machine check signal - probably due to mm fault\n"
                        "with mmu off\n");
                break;
-       case (1<<13) :
+       case (0x80000000>>13):
                printf("Transfer error ack signal\n");
                break;
-       case (1<<14) :
+       case (0x80000000>>14):
                printf("Data parity signal\n");
                break;
-       case (1<<15) :
+       case (0x80000000>>15):
                printf("Address parity signal\n");
                break;
        default:
@@ -159,7 +166,7 @@ MachineCheckException(struct pt_regs *regs)
 void
 AlignmentException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -171,11 +178,25 @@ AlignmentException(struct pt_regs *regs)
 void
 ProgramCheckException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+       unsigned char *p = regs ? (unsigned char *)(regs->nip) : NULL;
+       int i, j;
+
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
        show_regs(regs);
+
+       p = (unsigned char *) ((unsigned long)p & 0xFFFFFFE0);
+       p -= 32;
+       for (i = 0; i < 256; i+=16) {
+               printf("%08x: ", (unsigned int)p+i);
+               for (j = 0; j < 16; j++) {
+                       printf("%02x ", p[i+j]);
+               }
+               printf("\n");
+       }
+
        print_backtrace((unsigned long *)regs->gpr[1]);
        panic("Program Check Exception");
 }
@@ -183,7 +204,7 @@ ProgramCheckException(struct pt_regs *regs)
 void
 SoftEmuException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -196,7 +217,7 @@ SoftEmuException(struct pt_regs *regs)
 void
 UnknownException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif