AMX Target Guide Computer Accessories User Manual


 
12
K
A
DAK
AMX 68000 Target Guide
Default Exception Service Procedures
AMX provides default service procedures for most exceptions. The zero divide, bounds
check and overflow exceptions are serviced by AMX using its Task Trap Handler
mechanism. All other exceptions handled by AMX are treated as fatal. AMX calls a
Fatal Exception Procedure cjksfatalexh in module CJ532UF.C identifying the
exception and the machine state at the time of the exception. If the Fatal Exception
Procedure returns, AMX calls the Fatal Exit Procedure cjksfatal in the same module
with one of the following fatal exit codes:
CJ_FETRAP Fatal exception trap
CJ_FEISPTRAP Task exception trap in ISP
CJ_FETKTRAP Task exception trap occurred:
in a Restart Procedure or
in a Timer Procedure or
in a task with no task trap handler
The Fatal Exception Procedure is written in C as follows. Prior to entry, interrupts are
in the state determined by the particular exception.
#include "CJZZZ.H" /* AMX Headers */
void CJ_CCPP cjksfatalexh(
struct cjxregs *regp, /* A(Register structure) */
int vnum, /* Vector number */
void *faultfp) /* A(Fault frame) */
{
:
Process the error
:
}
The state of each register at the time of the fault is stored on the stack in an AMX register
structure cjxregs. Parameter regp is a pointer to that structure. Structure cjxregs is
defined in AMX header file CJ532KT.H.
Note that the
SR register copy in the register array reflects the state of the status register
after the exception occurred.
A pointer to the M68000 fault frame is provided as parameter
faultfp. This pointer is
the M68000 stack pointer (
SP) after the fault has occurred. Fault frame members can be
referenced as follows:
*((CJ_T16U *)faultfp) is the SR saved in the fault frame
*((CJ_T32U *)((CJ_T16U *)faultfp + 1))
is the A(fault instruction)
*((CJ_T16U *)faultfp + 3) is the frame format type and vector offset