ldrbt

Load Register Byte Unprivileged

LDRBT<c> <Rt>, [<Rn>, #+/-<imm>]

Loads a byte using User Mode permissions.

Details

Load Register Byte Unprivileged loads an unsigned byte from memory using unprivileged (User mode) permissions, regardless of the current privilege level, and writes it zero-extended to Rt. The address is computed from Rn plus an optionally pre-indexed or post-indexed 12-bit signed immediate offset. Condition flags are unaffected. This instruction is available in A32/T32 and is commonly used for accessing user-mode memory from privileged code.

Pseudocode Operation

address ← Rn + SignExtend(imm12)
Rt ← ZeroExtend([address][7:0])
if W then Rn ← address

Example

LDRBT r3, [r1, #+/-#16]

Encoding

Binary Layout
cond
010
0
U
1
1
1
Rn
Rt
imm12
 
Format Load/Store
Opcode 0x04700000
Extension A32 (Base)

Operands

  • Rt
    Transfer general-purpose register (load/store)
  • Rn
    First source / base general-purpose register
  • imm
    Signed immediate value

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x04700000 LDRBT{<c>}{<q>} <Rt>, [<Rn>] {, #{+/-}<imm>} A32 cond | 010 | 0 | U | 1 | 1 | 1 | Rn | Rt | imm12
0x06700000 LDRBT{<c>}{<q>} <Rt>, [<Rn>], {+/-}<Rm>{, <shift>} A32 cond | 011 | 0 | U | 1 | 1 | 1 | Rn | Rt | imm5 | stype | 0 | Rm
0xF8100E00 LDRBT{<c>}{<q>} <Rt>, [<Rn> {, #{+}<imm>}] T32 111110000 | 00 | 1 | Rn | Rt | 1110 | imm8

Description

Load Register Byte Unprivileged loads a byte from memory, zero-extends it to form a 32-bit word, and writes it to a register. For information about memory accesses see Memory accesses. The memory access is restricted as if the PE were running in User mode. This makes no difference if the PE is actually running in User mode. LDRBT is unpredictable in Hyp mode. The T32 instruction uses an offset addressing mode, that calculates the address used for the memory access from a base register value and an immediate offset, and leaves the base register unchanged. The A32 instruction uses a post-indexed addressing mode, that uses a base register value as the address for the memory access, and calculates a new address from a base register value and an offset and writes it back to the base register. The offset can be an immediate value or an optionally-shifted register value.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    if PSTATE.EL == EL2 then UNPREDICTABLE;               // Hyp mode
    offset = if register_form then Shift(R[m], shift_t, shift_n, PSTATE.C) else imm32;
    offset_addr = if add then (R[n] + offset) else (R[n] - offset);
    address = if postindex then R[n] else offset_addr;
    R[t] = ZeroExtend(MemU_unpriv[address,1],32);
    if postindex then R[n] = offset_addr;