st20-gp1 STMicroelectronics, st20-gp1 Datasheet - Page 27

no-image

st20-gp1

Manufacturer Part Number
st20-gp1
Description
Gps Processor
Manufacturer
STMicroelectronics
Datasheet
4.6.4
Trap handlers and trapped processes can be set up and examined via the ldtraph , sttraph ,
ldtrapped and sttrapped instructions. Table 4.8 describes the instructions that may be used when
dealing with traps.
The first four instructions transfer data to/from the trap handler structures or trapped process
structures from/to an area in memory. In these instructions Areg contains the trap group code (see
Table 4.4) and Breg points to the 4 word area of memory used as the source or destination of the
transfer. In addition Creg contains the priority of the handler to be installed/examined in the case of
ldtraph or sttraph. ldtrapped and sttrapped apply only to the current priority.
If the LoadTrap trap is enabled then ldtraph and ldtrapped do not perform the transfer but set the
LoadTrap trap flag. If the StoreTrap trap is enabled then sttraph and sttrapped do not perform the
transfer but set the StoreTrap trap flag.
The trap enable masks are encoded by an array of bits (see Table 4.5) which are set to indicate
which traps are enabled. This array of bits is stored in the lower half-word of the Enables register.
There is an Enables register for each priority. Traps are enabled or disabled by loading a mask into
Areg with bits set to indicate which traps are to be affected and the priority to affect in Breg.
Executing trapenb ORs the mask supplied in Areg with the trap enables mask in the Enables
register for the priority in Breg. Executing trapdis negates the mask supplied in Areg and ANDs it
with the trap enables mask in the Enables register for the priority in Breg. Both instructions return
the previous value of the trap enables mask in Areg.
4.6.5
There are various restrictions that must be placed on trap handlers to ensure that they work
correctly.
1
2
3
Instruction
ldtraph
sttraph
ldtrapped
sttrapped
trapenb
trapdis
tret
causeerror
Trap instructions
Restrictions on trap handlers
Trap handlers must not deschedule or timeslice. Trap handlers alter the Enables masks,
therefore they must not allow other processes to execute until they have completed.
Trap handlers must have their Enable masks set to mask all traps in their trap group to
avoid the possibility of a trap handler trapping to itself.
Trap handlers must terminate via the tret (trap return) instruction . The only exception to this
is that a scheduler kernel may use restart to return to a previously shadowed process.
Table 4.7 Instructions which may be used when dealing with traps
Meaning
load trap handler
store trap handler
load trapped
store trapped
trap enable
trap disable
trap return
cause error
Use
load the trap handler from memory to the trap handler descriptor
store an existing trap handler descriptor to memory
load replacement trapped process status from memory
store trapped process status to memory
enable traps
disable traps
used to return from a trap handler
program can simulate the occurrence of an error
ST20-GP1
27/116

Related parts for st20-gp1