ldrsht
Load Register Signed Halfword Unprivileged
LDRSHT<c> <Rt>, [<Rn>, #+/-<imm>]
Loads a signed halfword using User Mode permissions.
Details
Loads a signed halfword from memory using User Mode access permissions, ignoring the current privilege level. The loaded value is sign-extended to the full register width. No condition flags are affected. This is an A32 instruction that provides unprivileged memory access.
Pseudocode Operation
address ← Rn + (if U then imm else -imm); Rt ← SignExtend(Mem[address, 2], 16);
Example
LDRSHT r3, [r1, #+/-#16]
Encoding
Binary Layout
cond
000
0
U
1
1
1
Rn
Rt
imm4H
1
11
1
imm4L
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 | ||
|---|---|---|---|---|---|
| 0x007000F0 | LDRSHT{<c>}{<q>} <Rt>, [<Rn>] {, #{+/-}<imm>} | A32 | cond | 000 | 0 | U | 1 | 1 | 1 | Rn | Rt | imm4H | 1 | 11 | 1 | imm4L | ||
| 0x003000F0 | LDRSHT{<c>}{<q>} <Rt>, [<Rn>], {+/-}<Rm> | A32 | cond | 000 | 0 | U | 0 | 1 | 1 | Rn | Rt | 0 | 0 | 0 | 0 | 1 | 11 | 1 | Rm | ||
| 0xF9300E00 | LDRSHT{<c>}{<q>} <Rt>, [<Rn> {, #{+}<imm>}] | T32 | 111110010 | 01 | 1 | Rn | Rt | 1110 | imm8 |
Description
Load Register Signed Halfword Unprivileged loads a halfword 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.
LDRSHT 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;
data = MemU_unpriv[address,2];
if postindex then R[n] = offset_addr;
R[t] = SignExtend(data, 32);