strexd

Store Register Exclusive Double (A32)

STREXD<c> <Rd>, <Rt>, <Rt2>, [<Rn>]

Stores a doubleword if address is still exclusive.

Details

Conditionally stores a 64-bit doubleword from Rt and Rt2 to memory at the address in Rn if that address is still marked exclusive by the current processor. Writes 0 to Rd on success or 1 on failure. No condition flags are affected; exclusive monitor state determines the outcome.

Pseudocode Operation

address ← Rn; if ExclusiveMonitorsCheckExclusive(address, ProcessorID(), 8) then MemU[address, 8] ← Rt || Rt2; Rd ← 0; ExclusiveMonitorsClearExclusive(ProcessorID()); else Rd ← 1;

Example

STREXD r0, r3, r4, [r1]

Encoding

Binary Layout
cond
00011
01
0
Rn
Rd
1
1
1
1
1001
Rt
 
Format Load/Store Excl
Opcode 0x01A00F90
Extension A32 (Atomic)

Operands

  • Rd
    Status
  • Rt
    Transfer general-purpose register (load/store)
  • Rt2
    Second transfer register (load/store pair)
  • Rn
    First source / base general-purpose register

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x01A00F90 STREXD{<c>}{<q>} <Rd>, <Rt>, <Rt2>, [<Rn>] A32 cond | 00011 | 01 | 0 | Rn | Rd | 1 | 1 | 1 | 1 | 1001 | Rt
0xE8C00070 STREXD{<c>}{<q>} <Rd>, <Rt>, <Rt2>, [<Rn>] T32 11101000110 | 0 | Rn | Rt | Rt2 | 01 | 11 | Rd

Description

Store Register Exclusive Doubleword derives an address from a base register value, stores a 64-bit doubleword from two registers to the derived address if the executing PE has exclusive access to the memory at that address, and returns a status value of 0 if the store was successful, or of 1 if no store was performed. For more information about support for shared memory see Synchronization and semaphores. For information about memory accesses see Memory accesses.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    address = R[n];

    // Create doubleword to store such that R[t] will be stored at address and R[t2] at address+4.
    value = if BigEndian(AccessType_GPR) then R[t]:R[t2] else R[t2]:R[t];

    if AArch32.ExclusiveMonitorsPass(address,8) then
        MemA[address,8] = value;
        R[d] = ZeroExtend('0', 32);
    else
        R[d] = ZeroExtend('1', 32);