mpc85xx: Add support for the MPC8536
[oweals/u-boot.git] / cpu / mpc86xx / traps.c
index c84bfbf6aaaad74b0af9fcaaddc22b2818026394..13f386ddc847e7145957d0ba73f142f4bb99cbdf 100644 (file)
@@ -34,6 +34,8 @@
 #include <command.h>
 #include <asm/processor.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if defined(CONFIG_CMD_KGDB)
 int (*debugger_exception_handler)(struct pt_regs *) = 0;
 #endif
@@ -41,7 +43,13 @@ int (*debugger_exception_handler)(struct pt_regs *) = 0;
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
+/*
+ * End of addressable memory.  This may be less than the actual
+ * amount of memory on the system if we're unable to keep all
+ * the memory mapped in.
+ */
+extern ulong get_effective_memsize(void);
+#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize())
 
 /*
  * Trap & Exception support
@@ -50,8 +58,6 @@ extern unsigned long search_exception_table(unsigned long);
 void
 print_backtrace(unsigned long *sp)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        int cnt = 0;
        unsigned long i;
 
@@ -212,7 +218,7 @@ UnknownException(struct pt_regs *regs)
        if (debugger_exception_handler && (*debugger_exception_handler) (regs))
                return;
 #endif
-       printf("UnknownException regs@%x\n", regs);
+       printf("UnknownException regs@%lx\n", (ulong)regs);
        printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
               regs->nip, regs->msr, regs->trap);
        _exception(0, regs);