ldrsbt

Load Register Signed Byte Unprivileged

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

Loads a signed byte using User Mode permissions.

Details

Load Register Signed Byte Unprivileged loads a signed byte from memory using unprivileged (User mode) permissions, regardless of the current privilege level, and writes it sign-extended to Rt. The address is computed from Rn plus a 12-bit signed immediate offset (formed from two 4-bit fields). 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

offset ← (imm4_upper << 4) | imm4_lower
address ← Rn + SignExtend(offset)
Rt ← SignExtend([address][7:0])
if W then Rn ← address

Example

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

Encoding

Binary Layout
cond
000
0
U
1
1
1
Rn
Rt
imm4H
1
10
1
imm4L
 
Format Load/Store
Opcode 0x007000D0
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
0x007000D0 LDRSBT{<c>}{<q>} <Rt>, [<Rn>] {, #{+/-}<imm>} A32 cond | 000 | 0 | U | 1 | 1 | 1 | Rn | Rt | imm4H | 1 | 10 | 1 | imm4L
0x003000D0 LDRSBT{<c>}{<q>} <Rt>, [<Rn>], {+/-}<Rm> A32 cond | 000 | 0 | U | 0 | 1 | 1 | Rn | Rt | 0 | 0 | 0 | 0 | 1 | 10 | 1 | Rm
0xF9100E00 LDRSBT{<c>}{<q>} <Rt>, [<Rn> {, #{+}<imm>}] T32 111110010 | 00 | 1 | Rn | Rt | 1110 | imm8

Description

Load Register Signed Byte Unprivileged loads a byte from memory, sign-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. LDRSBT 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 a register value.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    if PSTATE.EL == EL2 then UNPREDICTABLE;               // Hyp mode
    offset = if register_form then R[m] 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] = SignExtend(MemU_unpriv[address,1], 32);
    if postindex then R[n] = offset_addr;