3.10.2 Execution Synchronization
For completeness, consider the definition of execution synchronizing as it relates to context
synchronization. Execution synchronization is architecturally a subset of context synchronization.
Execution synchronization guarantees that the
following requirement is met:
All instructions that precede an execution synchronizing operation must complete in the context
that existed before the execution synchronizing operation.
The
following requirement need not
be
met:
All instructions that follow an execution synchronizing operation must complete
in
the context that
exists
afterthe
execution synchronizing operation.
Execution synchronization ensures that preceding instructions execute
in
the old context; subsequent
instructions might execute
in
either the new or old context (indeterminate). The PPC405GP provides
three execution synchronizing operations: the eieio,
mtmsr,
and
sync
instructions.
Because
mtmsr
is execution synchronizing, it guarantees that previous instructions complete using
the old MSR value. (For example, using
nitmsr
to change the endian mode.) However, to guarantee
that subsequent instructions use the new MSR value, we have to insert a context synchronization
operation, such as
isync.
Note that the PowerPC Architecture requires MSR[EE] (the external interrupt bit) to be,
in
effect,
execution synchronizing: if a
mtmsr
sets MSR[EE] = 1 , and an external interrupt is pending, the
exception must be taken before the instruction that
follows
mtmsr
is executed. However, the
mtmsr
instruction is not a context synchronizing operation,
so
the PPC405GP does not, for example, discard
prefetched instructions and refetch. Note that the
wrtee
and
wrteei
instructions can change the value
of MSR[EE], but are not execution synchronizing.
Finally, while
sync
and
eieio
are execution synchronizing, they are also more restrictive
in
their
requirement of memory ordering. Stating that an operation is execution synchronizing does not imply
storage ordering. This is
an
additional specific requirement of
sync
and eieio.
3.10.3 Storage Synchronization
The
sync
instruction guarantees that all previous storage references complete with respect to the
PPC405GP before the
sync
instruction completes (therefore, before any subsequent instructions
begin
to
execute). The
sync
instruction is execution synchronizing.
Consider the following use of
sync:
stw Store to peripheral
sync Wait for store to actually complete
mtdcr Reconfigure device
3-46 PPC405GP User's Manual
Preliminary