summaryrefslogtreecommitdiff
path: root/src/arch/armv7/exception.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/armv7/exception.c')
-rw-r--r--src/arch/armv7/exception.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/arch/armv7/exception.c b/src/arch/armv7/exception.c
index 1055cb5663..3b32e8bbb1 100644
--- a/src/arch/armv7/exception.c
+++ b/src/arch/armv7/exception.c
@@ -27,9 +27,10 @@
* SUCH DAMAGE.
*/
-#include <console/console.h>
-#include <arch/exception.h>
#include <stdint.h>
+#include <types.h>
+#include <arch/exception.h>
+#include <console/console.h>
void exception_test(void);
@@ -43,20 +44,32 @@ void exception_not_used(uint32_t *);
void exception_irq(uint32_t *);
void exception_fiq(uint32_t *);
+static void dump_stack(uintptr_t addr, size_t bytes)
+{
+ int i, j;
+ const int line = 8;
+ uint32_t *ptr = (uint32_t *)(addr & ~(line * sizeof(*ptr) - 1));
+
+ printk(BIOS_ERR, "Dumping stack:\n");
+ for (i = bytes / sizeof(*ptr); i >= 0; i -= line) {
+ printk(BIOS_ERR, "%p: ", ptr + i);
+ for (j = i; j < i + line; j++)
+ printk(BIOS_ERR, "%08x ", *(ptr + j));
+ printk(BIOS_ERR, "\n");
+ }
+}
+
static void print_regs(uint32_t *regs)
{
int i;
- /* Don't print the link register and stack pointer since we don't have their
- * actual value. They are hidden by the 'shadow' registers provided
- * by the trap hardware.
- */
+
for (i = 0; i < 16; i++) {
if (i == 15)
printk(BIOS_ERR, "PC");
else if (i == 14)
- continue; /* LR */
+ printk(BIOS_ERR, "LR");
else if (i == 13)
- continue; /* SP */
+ printk(BIOS_ERR, "SP");
else if (i == 12)
printk(BIOS_ERR, "IP");
else
@@ -69,6 +82,7 @@ void exception_undefined_instruction(uint32_t *regs)
{
printk(BIOS_ERR, "exception _undefined_instruction\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
die("exception");
}
@@ -76,6 +90,7 @@ void exception_software_interrupt(uint32_t *regs)
{
printk(BIOS_ERR, "exception _software_interrupt\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
die("exception");
}
@@ -83,6 +98,7 @@ void exception_prefetch_abort(uint32_t *regs)
{
printk(BIOS_ERR, "exception _prefetch_abort\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
die("exception");
}
@@ -94,6 +110,7 @@ void exception_data_abort(uint32_t *regs)
} else {
printk(BIOS_ERR, "exception _data_abort\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
}
die("exception");
}
@@ -102,6 +119,7 @@ void exception_not_used(uint32_t *regs)
{
printk(BIOS_ERR, "exception _not_used\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
die("exception");
}
@@ -109,6 +127,7 @@ void exception_irq(uint32_t *regs)
{
printk(BIOS_ERR, "exception _irq\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
die("exception");
}
@@ -116,6 +135,7 @@ void exception_fiq(uint32_t *regs)
{
printk(BIOS_ERR, "exception _fiq\n");
print_regs(regs);
+ dump_stack(regs[13], 512);
die("exception");
}