source: rtems/doc/user/fatal.t @ 9c8530f7

4.104.114.84.9
Last change on this file since 9c8530f7 was 9c8530f7, checked in by Ralf Corsepius <ralf.corsepius@…>, on May 22, 2003 at 8:27:11 AM

2003-05-22 Ralf Corsepius <corsepiu@…>

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