块拷贝寻址
LDM/LDMIA/LDMFD
Load Multiple Increment After (Load Multiple Full Descending) loads multiple registers from consecutive memory
locations using an address from a base register. The consecutive memory locations start at this address, and the
address just above the highest of those locations can optionally be written back to the base register.
上面三者都是 LDM
指令,名字不同而已。LDMFD
通常在从满减栈中 pop 数据的场合使用。
LDM sp!, {R1-R7} // 等价于 pop {R1-R7}
The lowest-numbered register is loaded from the lowest memory address,
through to the highest-numbered register from the highest memory address.
低地址的数据加载到标号小的寄存器,高地址的数据加载到标号大的寄存器。
LDMIA R0!, {R1, R2, R3} --> addr=R0, R1 = [addr], R2 = [addr+4], R3 = [addr+8], R0 = R0+12
LDMIB/LDMED
Load Multiple Increment Before (Load Multiple Empty Descending) loads multiple registers from consecutive
memory locations using an address from a base register. The consecutive memory locations start just above this
address, and the address of the last of those locations can optionally be written back to the base register.
LDMED
通常用在空减栈中 pop 数据的场合使用。
LDMED R0!, {R1, R2, R3} --> addr = R0+4, R1 = [addr], R2 = [addr+4], R3 = [addr+8], R0 = R0+12
LDMDA/LDMFA
Load Multiple Decrement After (Load Multiple Full Ascending) loads multiple registers from consecutive memory
locations using an address from a base register. The consecutive memory locations end at this address, and the
address just below the lowest of those locations can optionally be written back to the base register.
与上面的区别是地址先减一个偏移再取数。LDMFA
通常用在满增栈中 pop 数据的场合使用。
LDMDA R0!, {R1, R2, R3} --> addr = R0-8, R1 = [addr], R2 = [addr+4], R3 = [addr+8], R0 = R0-12
LDMDB/LDMEA
Load Multiple Decrement Before (Load Multiple Empty Ascending) loads multiple registers from consecutive
memory locations using an address from a base register. The consecutive memory locations end just below this
address, and the address of the lowest of those locations can optionally be written back to the base register.
LDMEA
通常用在空增栈中 pop 数据的场合使用。
LDMEA R0!, {R1, R2, R3} --> addr = R0-12, R1 = [addr], R2 = [addr+4], R3 = [addr+8], R0 = R0-12
STM/STMIA/STMEA
Store Multiple Increment After (Store Multiple Empty Ascending) stores multiple registers to consecutive memory
locations using an address from a base register. The consecutive memory locations start at this address, and the
address just above the last of those locations can optionally be written back to the base register.
STMEA
通常用在空增栈中 push 数据的场合使用。
STMEA R0!, {R1, R2, R3} --> addr = R0, [addr] = R1, [addr+4] = R2, [addr+8] = R3, R0 = R0+12
STMDA/STMED
Store Multiple Decrement After (Store Multiple Empty Descending) stores multiple registers to consecutive
memory locations using an address from a base register. The consecutive memory locations end at this address, and
the address just below the lowest of those locations can optionally be written back to the base register.
STMED
通常用在空减栈中 push 数据的场合使用。
STMED R0!, {R1, R2, R3} --> addr = R0-8, [addr] = R1, [addr+4] = R2, [addr+8] = R3, R0 = R0-12
STMDB/STMFD
Store Multiple Decrement Before (Store Multiple Full Descending) stores multiple registers to consecutive memory
locations using an address from a base register. The consecutive memory locations end just below this address, and
the address of the first of those locations can optionally be written back to the base register.
STMFD
通常在从满减栈中 push 数据的场合使用。
STMDB sp!, {R1, R2, R3} // 等价于 push {R1, R2, R3}
The lowest-numbered register is stored to the lowest memory address,
through to the highest-numbered register to the highest memory address.
标号小的寄存器存放在低地址,标号大的寄存器存放在高地址。
STMDB R0!, {R1, R2, R3} --> addr = R0-12, [addr] = R1, [addr+4] = R2, [addr+8] = R3, R0 = R0-12
STMID/STMFA
Store Multiple Increment Before (Store Multiple Full Ascending) stores multiple registers to consecutive memory
locations using an address from a base register. The consecutive memory locations start just above this address, and
the address of the last of those locations can optionally be written back to the base register.
STMFA
通常在从满增栈中 push 数据的场合使用。
STMFA R0!, {R1, R2, R3} --> addr = R0+4, [addr] = R1, [addr+4] = R2, [addr+8] = R3, R0 = R0+12