Advanced Topics
K
A
DAK
147
13. Advanced Topics13.1 Fatal ExitThere are a number of conditions which, if encountered by AMX, are considered to be
fatal. Any attempt by AMX to continue execution will lead to unpredictable results at
best. All of these conditions cause AMX to force a branch to its fatal exit handler at
ajfatl.
Insufficient Memory
The most common of these conditions occurs at startup. Many of the AMX managers
include a Restart Procedure which is executed by AMX during its startup phase. Some of
these managers must initialize a portion of the AMX Data Segment which is private to
their needs. If any of these managers find that their needs exceed the size of th e data
segment provided in your AMX System Configuration Module, AMX takes its fatal exit.
To proceed would imply using memory which does not belong to AMX.
Task Error Traps
AMX will take its fatal exit if a processor dependent task trap exception such as division
by zero, arithmetic overflow or an array bound error occurs in any Restart Procedure,
Interrupt Service Procedure or Timer Procedure.
If any of these errors occur in a task which does not have a task trap handler (see Chapter
4.5) for the corresponding error, AMX will take its fatal exit.
AMX and its managers avoid instructions which produce arithmetic overflow or array
bound error exceptions. In the rare occasions when AMX or its managers use division,
the division is guaranteed not to produce a divide fault.
Invalid Shutdown
If you started AMX requesting permanent execution (see Chapter 2.4) and then attempt to
shut down your AMX system by calling ajexit, AMX will take its fatal exit path.
AMX Breakpoint Manager
If you include the AMX Breakpoint Manager in your system, it will attempt to install its
handlers for the debug exception, breakpoint exception and possibly the NMI interrupt
exception. If it is unable to install its handlers, the AMX Breakpoint Manager will force
a fatal exit.
Application Faults
If your application encounters conditions which are deemed fatal, you can take the AMX
fatal exit by calling procedure ajfatl or AAFATL. You can define your own negative
fatal error codes to identify your fatal error conditions.