Chapter 2. Programming Model
2-63
Instruction Set Summary
System designs with an external cache should take special care to recognize the hardware
signaling caused by a SYNC bus operation and perform the appropriate actions to
guarantee that memory references that can be queued internally to the external cache have
been performed globally.
See Section 2.3.5.2, òMemory Synchronization InstructionsVEA,ó for details about
additional memory synchronization (
eieio
and
isync
) instructions.
In the PowerPC architecture, the Rc bit must be zero for most load and store instructions.
If Rc is set, the instruction form is invalid for
sync
and
lwarx
instructions. If the MPC7400
encounters one of these invalid instruction forms, it sets CR0 to an undeTned value.
2.3.5 PowerPC VEA Instructions
The PowerPC virtual environment architecture (VEA) describes the semantics of the
memory model that can be assumed by software processes, and includes descriptions of the
cache model, cache control instructions, address aliasing, and other related issues.
Implementations that conform to the VEA also adhere to the UISA, but do not necessarily
adhere to the OEA.
This section describes additional instructions that are provided by the VEA.
Table 2-47. Memory Synchronization InstructionsUISA
Name
Mnemonic
Syntax
Implementation Notes
Load Word
and Reserve
Indexed
lwarx
r
D
,r
A
,r
B Programmers can use
lwarx
with
stwcx.
to emulate common semaphore
operations such as test and set, compare and swap, exchange memory, and
fetch and add. Both instructions
must use the same EA. Reservation
granularity is implementation-dependent. The MPC7400 makes reservations
on behalf of aligned 32-byte sections of the memory address space. Executing
lwarx
and
stwcx.
to a page marked write-through (WIMG = 10xx) or when the
L1 Data Cache is locked causes a DSI exception if the data cache is locked. If
the location is not word-aligned, an alignment exception occurs.
The
stwcx.
instruction is the only load/store instruction with a valid form if Rc
is set. If Rc is zero, executing
stwcx.
sets CR0 to an undeTned value.
Store Word
Conditional
Indexed
stwcx.
r
S
,r
A
,r
B
Synchronize
sync
Because it delays execution of subsequent instructions until all previous
instructions complete to where they cannot cause an exception,
sync
is a
barrier against store gathering. Additionally, all load/store cache/bus activities
initiated by prior instructions are completed. Touch load operations (
dcbt
,
dcbtst
) must complete address translation, but need not complete on the bus.
The
sync
completes after a successful broadcast on the system bus.
The latency of
sync
depends on the processor state when it is dispatched and
on various system-level situations. Note that, frequent use of
sync
will
degrade performance.