1 | /* except_template.c: |
---|
2 | * This code handles exceptions that are caught by the exception vectors |
---|
3 | * that have been installed by the monitor through vinit(). It is likely |
---|
4 | * that there is already a version of this function available for the CPU |
---|
5 | * being ported to, so check the cpu directory prior to porting this to a |
---|
6 | * new target. |
---|
7 | * |
---|
8 | * General notice: |
---|
9 | * This code is part of a boot-monitor package developed as a generic base |
---|
10 | * platform for embedded system designs. As such, it is likely to be |
---|
11 | * distributed to various projects beyond the control of the original |
---|
12 | * author. Please notify the author of any enhancements made or bugs found |
---|
13 | * so that all may benefit from the changes. In addition, notification back |
---|
14 | * to the author will allow the new user to pick up changes that may have |
---|
15 | * been made by other users after this version of the code was distributed. |
---|
16 | * |
---|
17 | * Author: Ed Sutter |
---|
18 | * email: esutter@lucent.com |
---|
19 | * phone: 908-582-2351 |
---|
20 | */ |
---|
21 | #include "config.h" |
---|
22 | #include "cpu.h" |
---|
23 | #include "cpuio.h" |
---|
24 | #include "genlib.h" |
---|
25 | #include "stddefs.h" |
---|
26 | #include "warmstart.h" |
---|
27 | |
---|
28 | ulong ExceptionAddr; |
---|
29 | int ExceptionType; |
---|
30 | |
---|
31 | /* exception(): |
---|
32 | * This is the first 'C' function called out of a monitor-installed |
---|
33 | * exception handler. |
---|
34 | */ |
---|
35 | void |
---|
36 | exception(void) |
---|
37 | { |
---|
38 | /* ADD_CODE_HERE */ |
---|
39 | |
---|
40 | /* Populating these two values is target specific. |
---|
41 | * Refer to other target-specific examples for details. |
---|
42 | * In some cases, these values are extracted from registers |
---|
43 | * already put into the register cache by the lower-level |
---|
44 | * portion of the exception handler in vectors_template.s |
---|
45 | */ |
---|
46 | ExceptionAddr = 0; |
---|
47 | ExceptionType = 0; |
---|
48 | |
---|
49 | /* Allow the console uart fifo to empty... |
---|
50 | */ |
---|
51 | flush_console_out(); |
---|
52 | monrestart(EXCEPTION); |
---|
53 | } |
---|
54 | |
---|
55 | /* vinit(): |
---|
56 | * This function is called by init1() at startup of the monitor to |
---|
57 | * install the monitor-based vector table. The actual functions are |
---|
58 | * in vectors.s. |
---|
59 | */ |
---|
60 | void |
---|
61 | vinit() |
---|
62 | { |
---|
63 | /* ADD_CODE_HERE */ |
---|
64 | } |
---|
65 | |
---|
66 | /* ExceptionType2String(): |
---|
67 | * This function simply returns a string that verbosely describes |
---|
68 | * the incoming exception type (vector number). |
---|
69 | */ |
---|
70 | char * |
---|
71 | ExceptionType2String(int type) |
---|
72 | { |
---|
73 | char *string; |
---|
74 | |
---|
75 | /* ADD_CODE_HERE */ |
---|
76 | return(string); |
---|
77 | } |
---|
78 | |
---|