2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2007-03-11 12:42:58 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2007 Michal Simek
|
|
|
|
*
|
|
|
|
* Michal SIMEK <monstr@monstr.eu>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2019-12-28 17:45:07 +00:00
|
|
|
#include <hang.h>
|
2007-05-08 12:52:52 +00:00
|
|
|
#include <asm/asm.h>
|
2007-03-11 12:42:58 +00:00
|
|
|
|
|
|
|
void _hw_exception_handler (void)
|
|
|
|
{
|
|
|
|
int address = 0;
|
|
|
|
int state = 0;
|
2015-01-26 13:36:13 +00:00
|
|
|
|
2007-03-11 12:42:58 +00:00
|
|
|
/* loading address of exception EAR */
|
2015-01-26 13:36:13 +00:00
|
|
|
MFS(address, rear);
|
2007-03-11 12:42:58 +00:00
|
|
|
/* loading excetpion state register ESR */
|
2015-01-26 13:36:13 +00:00
|
|
|
MFS(state, resr);
|
|
|
|
printf("Hardware exception at 0x%x address\n", address);
|
2015-01-26 13:32:23 +00:00
|
|
|
R17(address);
|
|
|
|
printf("Return address from exception 0x%x\n", address);
|
2007-03-11 12:42:58 +00:00
|
|
|
switch (state & 0x1f) { /* mask on exception cause */
|
|
|
|
case 0x1:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Unaligned data access exception\n");
|
2007-03-11 12:42:58 +00:00
|
|
|
break;
|
|
|
|
case 0x2:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Illegal op-code exception\n");
|
2007-03-11 12:42:58 +00:00
|
|
|
break;
|
|
|
|
case 0x3:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Instruction bus error exception\n");
|
2007-03-11 12:42:58 +00:00
|
|
|
break;
|
|
|
|
case 0x4:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Data bus error exception\n");
|
2007-03-11 12:42:58 +00:00
|
|
|
break;
|
|
|
|
case 0x5:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Divide by zero exception\n");
|
2007-03-11 12:42:58 +00:00
|
|
|
break;
|
2007-05-08 12:52:52 +00:00
|
|
|
#ifdef MICROBLAZE_V5
|
2014-01-20 20:17:07 +00:00
|
|
|
case 0x7:
|
|
|
|
puts("Priviledged or stack protection violation exception\n");
|
|
|
|
break;
|
2007-05-08 12:52:52 +00:00
|
|
|
case 0x1000:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Exception in delay slot\n");
|
2007-05-08 12:52:52 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2007-03-11 12:42:58 +00:00
|
|
|
default:
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("Undefined cause\n");
|
2007-03-11 12:42:58 +00:00
|
|
|
break;
|
|
|
|
}
|
2015-01-26 13:36:13 +00:00
|
|
|
printf("Unaligned %sword access\n", ((state & 0x800) ? "" : "half"));
|
|
|
|
printf("Unaligned %s access\n", ((state & 0x400) ? "store" : "load"));
|
|
|
|
printf("Register R%x\n", (state & 0x3E) >> 5);
|
|
|
|
hang();
|
2007-03-11 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#ifdef CONFIG_SYS_USR_EXCEP
|
2007-03-11 12:42:58 +00:00
|
|
|
void _exception_handler (void)
|
|
|
|
{
|
2015-01-26 13:36:13 +00:00
|
|
|
puts("User vector_exception\n");
|
|
|
|
hang();
|
2007-03-11 12:42:58 +00:00
|
|
|
}
|
|
|
|
#endif
|