English
Language : 

ST20-C1 Datasheet, PDF (71/205 Pages) STMicroelectronics – Instruction Set Reference Manual
6 Exceptions
Exception handler code is completed by executing the eret instruction, which restores
the state of the interrupted or trapped process. When an interrupt handler executes
eret, it also signals to the interrupt controller that the interrupt has completed. This
allows the interrupt handler to start a lower priority waiting interrupt if required.
The exception instructions are listed in Table 6.1.
Mnemonic
Name
ecall
exception call
eret
exception return
breakpoint
breakpoint
Table 6.1 Exception instructions
6.1 Exception levels
All exception handlers are identified by an integer called the exception level. Exception
levels 0 to HighestException (255) are available for user-defined exceptions, while
system exceptions have negative levels, as defined in Table 6.2.
Exception level
Name
0 - 255
-
-1
el_breakpoint_trap
-2
el_illegal_instr_trap
-3
el_idle_trap
-4
el_schedule_exception_trap
-5
el_run_trap
-6
el_stop_trap
-7
el_timeslice_trap
Circumstances when taken if not null
Interrupt, system call, DMA user process.
breakpoint instruction executed or DCU break-
point request.
Illegal op-code encountered.
CPU becomes idle.
Schedule a user process as an exception.
Execute a run instruction.
Execute a stop instruction.
Take a timeslice.
Table 6.2 Exception levels
Any exception may be triggered from software with the ecall instruction. User-defined
exceptions can be interrupt handlers, user processes waiting for DMA peripherals or
trap handlers used as system calls by executing ecall.
System exceptions are traps which may be triggered automatically when the CPU is in
certain states. They are intended mainly for operating system kernels to trap sched-
uling events and for debuggers to trap breakpoints. The circumstances in which each
system trap is taken are as follows:
• el_breakpoint_trap
This trap is taken when either a breakpoint instruction is executed or a diag-
nostic controller (DCU) signals to the CPU requesting a breakpoint. If the trap
is null then the process continues. This trap is used by debuggers.
71/205
®