Signal()
Motorola
Software-Hardware Integration
For More Information On This Product,
Go to: www.freescale.com
6-11
Modification of the signal file is only recommended when optimization of the service time
is critical to the application.
Upon return from the C signal handler, all the registers are restored. Finally, the
rti
instruction is executed to return to the code that was executing when the interrupt
occurred. Notice two factors in this scheme,
1. all registers are saved and restored before and after the C signal handler and
2. the
rti
instruction is executed by the
_ _c_sig_dispatch()
function.
Warning
The signal handler must not contain the
rti
instruction at the
end of the program regardless which language is used to
program the interrupt. The signal handler does not need to
save or restore any context or registers. The function
_
_c_sig_dispatch()
will not act like a normal C function
because it never returns to its caller. Instead, it will return to
the code that was executing when the interrupt happened by
executing the
rti
instruction.
Assembly language interrupt handlers can coexist with C signal handlers. The code in the
signal file will not alter any interrupt vector except the one specified by the signal number
passed to the
signal()
function (see the first of the three steps above). The C signal
interface could be used with an assembly routine but would be unnecessarily slow. To use
an assembly language interrupt handler, alter the vector (e.g., interrupt 08) with a
jsr
to it
(e.g., jsr interrupt 08)or use a fast interrupt routine.
6.9.1 Raise()
The
raise()
function is used to simulate an interrupt. The code in
raise()
simply calls the
entry in
_ _c_sig_goto_dispatch
that is matched to the interrupt vector specified by the
signal number passed.
The ANSI standard signal handlers
SIG_DFL
,
SIG_ERR
and
SIG_IGN
are
implemented by the hand-coded functions
_ _sig_dfl()
,
_ _sig_err()
and _ _
sig_ign()
,
respectively.
1. SIG_DFL notes that the interrupt happened by incrementing
_ _sig_drop_count
and then returns.
2. SIG_ERR calls
abort()
and never returns.
3. SIG_IGN returns without any effect (i.e., ignore).
F
Freescale Semiconductor, Inc.
n
.