ARM 多寄存器寻址 (块拷贝寻址)

块拷贝寻址

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值