1 | @c |
---|
2 | @c COPYRIGHT (c) 1996. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | |
---|
7 | @ifinfo |
---|
8 | @node Fatal Error Manager, Fatal Error Manager Introduction, IO_CONTROL - Special device services, Top |
---|
9 | @end ifinfo |
---|
10 | @chapter Fatal Error Manager |
---|
11 | @ifinfo |
---|
12 | @menu |
---|
13 | * Fatal Error Manager Introduction:: |
---|
14 | * Fatal Error Manager Background:: |
---|
15 | * Fatal Error Manager Operations:: |
---|
16 | * Fatal Error Manager Directives:: |
---|
17 | @end menu |
---|
18 | @end ifinfo |
---|
19 | |
---|
20 | @ifinfo |
---|
21 | @node Fatal Error Manager Introduction, Fatal Error Manager Background, Fatal Error Manager, Fatal Error Manager |
---|
22 | @end ifinfo |
---|
23 | @section Introduction |
---|
24 | |
---|
25 | The fatal error manager processes all fatal or |
---|
26 | irrecoverable errors. The directive provided by the fatal error |
---|
27 | manager is: |
---|
28 | |
---|
29 | @itemize @bullet |
---|
30 | @item @code{fatal_error_occurred} - Invoke the fatal error handler |
---|
31 | @end itemize |
---|
32 | |
---|
33 | |
---|
34 | |
---|
35 | @ifinfo |
---|
36 | @node Fatal Error Manager Background, Fatal Error Manager Operations, Fatal Error Manager Introduction, Fatal Error Manager |
---|
37 | @end ifinfo |
---|
38 | @section Background |
---|
39 | |
---|
40 | The fatal error manager is called upon detection of |
---|
41 | an irrecoverable error condition by either RTEMS or the |
---|
42 | application software. Fatal errors can be detected from three |
---|
43 | sources: |
---|
44 | |
---|
45 | @itemize @bullet |
---|
46 | @item the executive (RTEMS) |
---|
47 | @item user system code |
---|
48 | @item user application code |
---|
49 | @end itemize |
---|
50 | |
---|
51 | RTEMS automatically invokes the fatal error manager |
---|
52 | upon detection of an error it considers to be fatal. Similarly, |
---|
53 | the user should invoke the fatal error manager upon detection of |
---|
54 | a fatal error. |
---|
55 | |
---|
56 | Each status or dynamic user extension set may include |
---|
57 | a fatal error handler. The fatal error handler in the static |
---|
58 | extension set can be used to provide access to debuggers and |
---|
59 | monitors which may be present on the target hardware. If any |
---|
60 | user-supplied fatal error handlers are installed, the fatal |
---|
61 | error manager will invoke them. If no user handlers are |
---|
62 | configured or if all the user handler return control to the |
---|
63 | fatal error manager, then the RTEMS default fatal error handler |
---|
64 | is invoked. If the default fatal error handler is invoked, then |
---|
65 | the system state is marked as failed. |
---|
66 | |
---|
67 | Although the precise behavior of the default fatal |
---|
68 | error handler is processor specific, in general, it will disable |
---|
69 | all maskable interrupts, place the error code in a known |
---|
70 | processor dependent place (generally either on the stack or in a |
---|
71 | register), and halt the processor. The precise actions of the |
---|
72 | RTEMS fatal error are discussed in the Default Fatal Error |
---|
73 | Processing chapter of the C Applications Supplement document for |
---|
74 | a specific target processor. |
---|
75 | |
---|
76 | @ifinfo |
---|
77 | @node Fatal Error Manager Operations, Announcing a Fatal Error, Fatal Error Manager Background, Fatal Error Manager |
---|
78 | @end ifinfo |
---|
79 | @section Operations |
---|
80 | @ifinfo |
---|
81 | @menu |
---|
82 | * Announcing a Fatal Error:: |
---|
83 | @end menu |
---|
84 | @end ifinfo |
---|
85 | |
---|
86 | @ifinfo |
---|
87 | @node Announcing a Fatal Error, Fatal Error Manager Directives, Fatal Error Manager Operations, Fatal Error Manager Operations |
---|
88 | @end ifinfo |
---|
89 | @subsection Announcing a Fatal Error |
---|
90 | |
---|
91 | The fatal_error_occurred directive is invoked when a |
---|
92 | fatal error is detected. Before invoking any user-supplied |
---|
93 | fatal error handlers or the RTEMS fatal error handler, the |
---|
94 | fatal_error_occurred directive stores useful information in the |
---|
95 | variable _Internal_errors_What_happened. This structure |
---|
96 | contains three pieces of information: |
---|
97 | |
---|
98 | @itemize @bullet |
---|
99 | @item the source of the error (API or executive core), |
---|
100 | |
---|
101 | @item whether the error was generated internally by the |
---|
102 | executive, and a |
---|
103 | |
---|
104 | @item a numeric code to indicate the error type. |
---|
105 | @end itemize |
---|
106 | |
---|
107 | The error type indicator is dependent on the source |
---|
108 | of the error and whether or not the error was internally |
---|
109 | generated by the executive. |
---|
110 | |
---|
111 | The fatal_error_directive directive is responsible |
---|
112 | for invoking an optional user-supplied fatal error handler |
---|
113 | and/or the RTEMS fatal error handler. All fatal error handlers |
---|
114 | are passed an error code to describe the error detected. |
---|
115 | |
---|
116 | Occasionally, an application requires more |
---|
117 | sophisticated fatal error processing such as passing control to |
---|
118 | a debugger. For these cases, a user-supplied fatal error |
---|
119 | handler can be specified in the RTEMS configuration table. The |
---|
120 | User Extension Table field fatal contains the address of the |
---|
121 | fatal error handler to be executed when the fatal_error_occurred |
---|
122 | directive is called. If the field is set to NULL or if the |
---|
123 | configured fatal error handler returns to the executive, then |
---|
124 | the default handler provided by RTEMS is executed. This default |
---|
125 | handler will halt execution on the processor where the error |
---|
126 | occurred. |
---|
127 | |
---|
128 | @ifinfo |
---|
129 | @node Fatal Error Manager Directives, FATAL_ERROR_OCCURRED - Invoke the fatal error handler, Announcing a Fatal Error, Fatal Error Manager |
---|
130 | @end ifinfo |
---|
131 | @section Directives |
---|
132 | @ifinfo |
---|
133 | @menu |
---|
134 | * FATAL_ERROR_OCCURRED - Invoke the fatal error handler:: |
---|
135 | @end menu |
---|
136 | @end ifinfo |
---|
137 | |
---|
138 | This section details the fatal error manager's |
---|
139 | directives. A subsection is dedicated to each of this manager's |
---|
140 | directives and describes the calling sequence, related |
---|
141 | constants, usage, and status codes. |
---|
142 | |
---|
143 | @page |
---|
144 | @ifinfo |
---|
145 | @node FATAL_ERROR_OCCURRED - Invoke the fatal error handler, Scheduling Concepts, Fatal Error Manager Directives, Fatal Error Manager Directives |
---|
146 | @end ifinfo |
---|
147 | @subsection FATAL_ERROR_OCCURRED - Invoke the fatal error handler |
---|
148 | |
---|
149 | @subheading CALLING SEQUENCE: |
---|
150 | |
---|
151 | @example |
---|
152 | void volatile rtems_fatal_error_occurred( |
---|
153 | rtems_unsigned32 the_error |
---|
154 | ); |
---|
155 | @end example |
---|
156 | |
---|
157 | @subheading DIRECTIVE STATUS CODES |
---|
158 | |
---|
159 | NONE |
---|
160 | |
---|
161 | @subheading DESCRIPTION: |
---|
162 | |
---|
163 | This directive processes fatal errors. If the FATAL |
---|
164 | error extension is defined in the configuration table, then the |
---|
165 | user-defined error extension is called. If configured and the |
---|
166 | provided FATAL error extension returns, then the RTEMS default |
---|
167 | error handler is invoked. This directive can be invoked by |
---|
168 | RTEMS or by the user's application code including initialization |
---|
169 | tasks, other tasks, and ISRs. |
---|
170 | |
---|
171 | @subheading NOTES: |
---|
172 | |
---|
173 | This directive supports local operations only. |
---|
174 | |
---|
175 | Unless the user-defined error extension takes special |
---|
176 | actions such as restarting the calling task, this directive WILL |
---|
177 | NOT RETURN to the caller. |
---|
178 | |
---|
179 | The user-defined extension for this directive may |
---|
180 | wish to initiate a global shutdown. |
---|