
ST20-GP1
25/116
Trap groups encoding is shown in Table 4.4 below. These codes are used to identify trap groups to
various instructions.
In addition to the trap groups mentioned above, the
CauseError
flag in the
Status
register is used
to signal when a trap condition has been activated by the causeerror nstruction. It can be used to
indicate when trap conditions have occurred due to the user setting them, rather than by the
system.
4.6.2
Table 4.4 summarizes the events that can cause traps and gives the encoding of bits in the trap
Status
and
Enable
words.
Events that can cause traps
Trap group
Code
Breakpoint
0
CPU Errors
1
System operations
2
Scheduler
3
Table 4.3 Trap group codes
Trap cause
Status/Enable
codes
Trap
group
Comments
Breakpoint
0
0
When a process executes the breakpoint instruction (j0) then it traps
to its trap handler.
IntegerError
1
1
Integer error other than integer overflow – e.g. explicitly checked or
explicitly set error.
Overflow
2
1
Integer overflow or integer division by zero.
IllegalOpcode
3
2
Attempt to execute an illegal instruction. This is signalled when opr
(operate) is executed with an invalid operand.
LoadTrap
4
2
When the trap descriptor is read with the ldtraph(load trap handler)
instruction or when the trapped process status is read with the
ldtrapped (load trapped) nstruction.
StoreTrap
5
2
When the trap descriptor is written with the sttraph (store trap handler)
instruction or when the trapped process status is written with the
sttrapped (store trapped) nstruction.
InternalChannel
6
3
Scheduler trap from internal channel.
ExternalChannel
7
3
Scheduler trap from external channel.
Timer
8
3
Scheduler trap from timer alarm.
Timeslice
9
3
Scheduler trap from timeslice.
Run
10
3
Scheduler trap from runp (run process) or startp(start process).
Signal
11
3
Scheduler trap from signal.
ProcessInterrupt
12
3
Start executing a process at a new priority level.
QueueEmpty
13
3
Caused by no process active at a priority level.
CauseError
15 (Status only)
Any,
encoded
0-3
Signals that the causeerror nstruction set the trap flag.
Table 4.4 Trap causes and
Status
/
Enable
codes