
MOTOROLA
Chapter 5. Exceptions
5-17
Process Switching
functions as
rfi
, except that it uses CSRR0 and CSRR1 to restore the processor state. Thus,
execution of the
rfci
instruction ensures the following:
CSRR1[0, 5–9, 16–31] are placed into the corresponding bits of the MSR. If the new
MSR value does not enable any pending exceptions, the next instruction is fetched
from the address defined by CSRR0[0–29] || 0b00.
If the new MSR value enables one or more pending exceptions, the exception
associated with the highest priority pending exception is generated. In this case, the
exception processing mechanism places in SRR0 the address of the instruction
which would have executed next had the exception not occurred.
5.3
Process Switching
The operating system should execute one of the following when processes are switched:
The
sync
instruction, which orders the effects of instruction execution. All
instructions previously initiated appear to have completed before the
sync
instruction completes, and no subsequent instructions appear to be initiated until the
sync
instruction completes. For an example showing the use of a
sync
instruction,
see Chapter 2, “Register Set,” of the
Programming Environments Manual.
The
isync
instruction, which waits for all previous instructions to complete and then
discards any fetched instructions, causing subsequent instructions to be fetched (or
refetched) from memory and to execute in the context (privilege, translation,
protection, etc.) established by the previous instructions.
The
stwcx.
instruction, to clear any outstanding reservations, which ensures that an
lwarx
instruction in the old process is not paired with an
stwcx.
instruction in the
new process.
The operating system should set the MSR[RI] bit as described in Section 5.2.4, “Setting
MSR[RI].”
5.4
Exception Latencies
Latencies for taking various exceptions depend on the state of the machine when the
exception conditions occur. This latency may be as short as one cycle, in which case an
exception is signaled in the cycle following the appearance of the exception condition. The
latencies are as follows:
Hard reset and machine check—In most cases, a hard reset or machine check
exception will have a single-cycle latency. A two- to three-cycle delay may occur
only when a predicted instruction is next to complete, and the branch guess that
forced this instruction to be predicted was resolved to be incorrect.
Soft reset—The latency of a soft reset exception is affected by recoverability. The
time to reach a recoverable state may depend on the time needed to complete or
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.