summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-08-07 19:36:27 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-08-07 19:36:30 +0200
commitfde45de7351264cd27a9024ea2b6620d170b5269 (patch)
tree8d156ff817ad01201251f04bd0fd62b7d287364e
parent8ec0f5550617aebac566a4aaffac644d16c3a5f4 (diff)
downloadbarebox-fde45de7351264cd27a9024ea2b6620d170b5269.tar.gz
barebox-fde45de7351264cd27a9024ea2b6620d170b5269.tar.xz
ARM: some cleanup in interrupts.c
- Don't call panic with "resetting CPU...". Depending on the configuration the system might also hang. - panic does not return, so no need to call reset_cpu afterwards - bundle show_regs and panic into a seperate functions to not have to call both functions from each exception handler Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/cpu/interrupts.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/arch/arm/cpu/interrupts.c b/arch/arm/cpu/interrupts.c
index 0c21bc10cf..3d2077f491 100644
--- a/arch/arm/cpu/interrupts.c
+++ b/arch/arm/cpu/interrupts.c
@@ -30,15 +30,6 @@
#include <asm/unwind.h>
/**
- * FIXME
- */
-static void bad_mode (void)
-{
- panic ("Resetting CPU ...\n");
- reset_cpu (0);
-}
-
-/**
* Display current register set content
* @param[in] regs Guess what
*/
@@ -82,6 +73,13 @@ void show_regs (struct pt_regs *regs)
#endif
}
+static void __noreturn do_exception(struct pt_regs *pt_regs)
+{
+ show_regs(pt_regs);
+
+ panic("");
+}
+
/**
* The CPU runs into an undefined instruction. That really should not happen!
* @param[in] pt_regs Register set content when the accident happens
@@ -89,8 +87,7 @@ void show_regs (struct pt_regs *regs)
void do_undefined_instruction (struct pt_regs *pt_regs)
{
printf ("undefined instruction\n");
- show_regs (pt_regs);
- bad_mode ();
+ do_exception(pt_regs);
}
/**
@@ -103,8 +100,7 @@ void do_undefined_instruction (struct pt_regs *pt_regs)
void do_software_interrupt (struct pt_regs *pt_regs)
{
printf ("software interrupt\n");
- show_regs (pt_regs);
- bad_mode ();
+ do_exception(pt_regs);
}
/**
@@ -116,8 +112,7 @@ void do_software_interrupt (struct pt_regs *pt_regs)
void do_prefetch_abort (struct pt_regs *pt_regs)
{
printf ("prefetch abort\n");
- show_regs (pt_regs);
- bad_mode ();
+ do_exception(pt_regs);
}
/**
@@ -128,9 +123,15 @@ void do_prefetch_abort (struct pt_regs *pt_regs)
*/
void do_data_abort (struct pt_regs *pt_regs)
{
- printf ("data abort\n");
- show_regs (pt_regs);
- bad_mode ();
+ u32 far;
+
+ asm volatile ("mrc p15, 0, %0, c6, c0, 0" : "=r" (far) : : "cc");
+
+ printf("unable to handle %s at address 0x%08x\n",
+ far < PAGE_SIZE ? "NULL pointer dereference" :
+ "paging request", far);
+
+ do_exception(pt_regs);
}
/**
@@ -142,8 +143,7 @@ void do_data_abort (struct pt_regs *pt_regs)
void do_fiq (struct pt_regs *pt_regs)
{
printf ("fast interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
+ do_exception(pt_regs);
}
/**
@@ -155,6 +155,5 @@ void do_fiq (struct pt_regs *pt_regs)
void do_irq (struct pt_regs *pt_regs)
{
printf ("interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
+ do_exception(pt_regs);
}