Added some stuff to README.
[rpi-open-firmware.git] / trap.c
1 /*=============================================================================
2 Copyright (C) 2016 Kristina Brooks
3 All rights reserved.
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 FILE DESCRIPTION
16 VideoCoreIV second level exception handlers.
17
18 =============================================================================*/
19
20 #include "lib/common.h"
21 #include "hardware.h"
22
23 /*
24 * this file in the public release documents all exception names.
25 * brcm_usrlib\dag\vmcsx\vcfw\rtos\none\rtos_none.c
26 */
27
28 static const char* g_ExceptionNames[] = {
29 "zero",
30 "misaligned",
31 "divide by zero",
32 "undefined instruction",
33 "forbidden instruction",
34 "illegal memory",
35 "bus error",
36 "floating point",
37 "isp",
38 "dummy",
39 "icache",
40 "vec core",
41 "bad l2 alias",
42 "breakpoint"
43 };
44
45 static const char* exception_name(uint32_t n) {
46 if (n >= (sizeof(g_ExceptionNames)/4))
47 return "unknown";
48 return g_ExceptionNames[n];
49 }
50
51 void sleh_fatal(uint32_t n, uint32_t pc) {
52 panic("fatal processor exception: %s (%d) at 0x%0x", exception_name(n), n, pc);
53 }
This page took 0.068096 seconds and 4 git commands to generate.