
MOTOROLA
Chapter 2. Programming Model
2-39
If the store was successful, the sequence of instructions from the read of the semaphore to
the store that updated the semaphore appear to have been executed atomically (that is, no
other processor or mechanism modified the semaphore location between the read and the
update), thus providing the equivalent of a real atomic operation. However, in reality, other
processors may have read from the location during this operation. In the 603e, the
reservations are made on behalf of aligned 32-byte sections of the memory address space.
The
lwarx
and
stwcx.
instructions require the EA to be aligned. Exception handling
software should not attempt to emulate a misaligned
lwarx
or
stwcx.
instruction, because
there is no correct way to define the address associated with the reservation.
In general, the
lwarx
and
stwcx.
instructions should be used only in system programs,
which can be invoked by application programs as needed.
At most, one reservation exists simultaneously on any processor. The address associated
with the reservation can be changed by a subsequent
lwarx
instruction. The conditional
store is performed based upon the existence of a reservation established by the preceding
lwarx
regardless of whether the address generated by the
lwarx
matches that generated by
the
stwcx.
instruction. A reservation held by the processor is cleared by one of the
following:
Executing an
stwcx.
instruction to any address
Attempt by some other device to modify a location in the reservation granularity
(32 bytes)
The
lwarx
and
stwcx.
instructions in write-through access mode do not cause a DSI
exception.
Table 2-31 lists the UISA memory synchronization instructions for the 603e.
2.3.5 PowerPC VEA Instructions
The PowerPC 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.
2.3.5.1 Processor Control Instructions
In addition to the move to condition register instructions specified by the UISA, the VEA
defines the Move from Time Base (
mftb
) instruction for reading the contents of the time
base register. The
mftb
is a user-level instruction, it is shown in Table 2-32.
Table 2-31. Memory Synchronization Instructions—UISA
Name
Mnemonic
Operand Syntax
Load Word and Reserve Indexed
lwarx
r
D
,r
A
,r
B
Store Word Conditional Indexed
stwcx.
r
S
,r
A
,r
B
Synchronize
sync
—