lbarx

Load Byte And Reserve Indexed

lbarx RT,RA,RB,EH
lbarx RT,RA,RB

Loads a byte from memory and reserves the location for exclusive access.

Details

The lbarx instruction loads a byte from memory into a register and reserves the location for exclusive access. The effective address is computed as the sum of the contents of registers RA and RB, with RA being zero-extended to 64 bits if it is not already. The reservation is associated with the real address computed from the effective address.

Pseudocode Operation

if RA = 0 then b ← 0
else           b ← (RA)
EA ← b + (RB)
RESERVE ← 1
RESERVE_LENGTH ← 1
RESERVE_ADDR ← real_addr(EA)
RT ← 560 || MEM(EA, 1)

Programming Note

lbarx serves as both a basic and an extended mnemonic. The Assembler will recognize a lbarx mnemonic with four operands as the basic form, and a lbarx mnemonic with three operands as the extended form. In the extended form the EH operand is omitted and assumed to be 0.

Example

lbarx r3, r4, r5, 0

Encoding

Binary Layout
31
0
RT
6
RA
11
RB
16
52
21
0
 
Format X-form
Opcode 0x7C000034
Extension Base
Registers Altered RESERVE, RESERVE_LENGTH, RESERVE_ADDR

Operands

  • RT
    Target
  • RA
    Base
  • RB
    Index
  • EH
    Hint for subsequent store operation