blob: 227842f6a483a585a36574fa5857557c00affc61 [file] [log] [blame]
Michal Simek952d5142007-03-11 13:42:58 +01001/*
2 * (C) Copyright 2007 Michal Simek
3 *
4 * Michal SIMEK <monstr@monstr.eu>
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Michal Simek952d5142007-03-11 13:42:58 +01007 */
8
9#include <common.h>
Michal Simek3af398e2007-05-08 14:52:52 +020010#include <asm/asm.h>
Michal Simek952d5142007-03-11 13:42:58 +010011
12void _hw_exception_handler (void)
13{
14 int address = 0;
15 int state = 0;
16 /* loading address of exception EAR */
Michal Simekebf7b232007-05-08 15:57:43 +020017 MFS (address, rear);
Michal Simek952d5142007-03-11 13:42:58 +010018 /* loading excetpion state register ESR */
Michal Simekebf7b232007-05-08 15:57:43 +020019 MFS (state, resr);
Michal Simek952d5142007-03-11 13:42:58 +010020 printf ("Hardware exception at 0x%x address\n", address);
21 switch (state & 0x1f) { /* mask on exception cause */
22 case 0x1:
23 puts ("Unaligned data access exception\n");
24 break;
25 case 0x2:
26 puts ("Illegal op-code exception\n");
27 break;
28 case 0x3:
29 puts ("Instruction bus error exception\n");
30 break;
31 case 0x4:
32 puts ("Data bus error exception\n");
33 break;
34 case 0x5:
35 puts ("Divide by zero exception\n");
36 break;
Michal Simek3af398e2007-05-08 14:52:52 +020037#ifdef MICROBLAZE_V5
Michal Simek98565292014-01-20 21:17:07 +010038 case 0x7:
39 puts("Priviledged or stack protection violation exception\n");
40 break;
Michal Simek3af398e2007-05-08 14:52:52 +020041 case 0x1000:
42 puts ("Exception in delay slot\n");
43 break;
44#endif
Michal Simek952d5142007-03-11 13:42:58 +010045 default:
46 puts ("Undefined cause\n");
47 break;
48 }
49 printf ("Unaligned %sword access\n", ((state & 0x800) ? "" : "half"));
50 printf ("Unaligned %s access\n", ((state & 0x400) ? "store" : "load"));
51 printf ("Register R%x\n", (state & 0x3E) >> 5);
52 hang ();
53}
54
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020055#ifdef CONFIG_SYS_USR_EXCEP
Michal Simek952d5142007-03-11 13:42:58 +010056void _exception_handler (void)
57{
58 puts ("User vector_exception\n");
59 hang ();
60}
61#endif