9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2011-08-07 19:36:27 +02:00
parent 8ec0f55506
commit fde45de735
1 changed files with 21 additions and 22 deletions

View File

@ -29,15 +29,6 @@
#include <asm/ptrace.h>
#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);
}