Mapping Local Registers To The Procedure Stack; Modifying The Pfp Register - Intel i960 Jx Developer's Manual

Microprocessor
Table of Contents

Advertisement

7.1.5

Mapping Local Registers to the Procedure Stack

Each local register set is mapped to a register save area of its respective frame in the procedure
stack
(Figure
7-1). Saved local register sets are frequently cached on-chip rather than saved to
memory. The caching mechanism is not write-through. Local register set contents are not saved
automatically to the save area in memory when the register set is cached. This would cause a
significant performance loss for call operations.
Also, no automatic update policy is implemented for the register cache. When the register save area
in memory for a cached register set is modified, there is no guarantee that the modification is
reflected when the register set is restored. For a frame spill, the set must be flushed to memory
prior to the modification for the modification to be valid.
The
flushreg
instruction causes the contents of all cached local register sets to be written (flushed)
to their associated stack frames in memory. The register cache is then invalidated, meaning that all
flushed register sets are restored from their save areas in memory. The current set of local registers
is not written to memory.
flushreg
to all saved local registers. In this way, call history may be traced back through nested procedures.
is also used when implementing task switches in multitasking kernels. The procedure
flushreg
stack is changed as part of the task switch. To change the procedure stack,
update the current procedure stack and invalidate all entries in the local register cache. Next, the
procedure stack is changed by directly modifying the FP and SP registers and executing a call
operation. After
executes, the procedure stack may also be changed by modifying the
flushreg
previous frame in memory and executing a return operation.
When a set of local registers is assigned to a new procedure, the processor may or may not clear or
initialize these registers. Therefore, initial register contents are unpredictable. Also, the processor
does not initialize the local register save area in the newly created stack frame for the procedure; its
contents are equally unpredictable.
7.2

MODIFYING THE PFP REGISTER

The FP must not be directly modified by user software or risk corrupting the local registers.
Instead, implement context switches by modifying the PFP.
Modification of the PFP is typically for context switches; as part of the switch, the active procedure
changes the pointer to the frame that it returns to (previous frame pointer — PFP). Great care should
be taken in modifying the PFP. In the general case, a
modifying the PFP when the local register cache is enabled (see
ensures the correct operation of a context switch on all i960 processors in all situations.
is commonly used in debuggers or fault handlers to gain access
flushreg
PROCEDURE CALLS
flushreg
is executed to
must be issued before and after
Example
7-1). This requirement
7
7-11

Advertisement

Table of Contents
loading

Table of Contents