ARM汇编多寄存器寻址

ARM汇编多寄存器寻址原文转自:http://hi.baidu.com/mugua/item/c43f37cc55a75d35ee4665e6多寄存器和堆栈寻址的用法:多寄存器寻址:LDMIA,LDMIB,STMIA,STMIB,LDMDA,LDMDB,STMDA,STMDB;堆栈寻址:LDMFA,LDMFD,STMFA,STMFD,LDMEA,LDMED,STMEA,STMED;弄清堆栈寻

大家好,欢迎来到IT知识分享网。ARM汇编多寄存器寻址

原文转自:http://hi.baidu.com/mugua/item/c43f37cc55a75d35ee4665e6

多寄存器和堆栈寻址的用法:多寄存器寻址:LDMIA,LDMIB,STMIA,STMIB,LDMDA,LDMDB,STMDA,STMDB;
堆栈寻址:LDMFA,LDMFD,STMFA,STMFD,LDMEA,LDMED,STMEA,STMED;

弄清堆栈寻址的SP的变化:LDMFA,LDMFD,STMFA,STMFD,LDMEA,LDMED,STMEA,STMED;

IA: 每次传送后地址加4;


IB: 每次传送前地址加4;


DA: 每次传送后地址减4;


DB: 每次传送前地址减4;


FD: 满递减堆栈;


ED: 空递减堆栈;


FA: 满递增堆栈;


EA: 空递增堆栈。

1、多寄存器寻址:
LDMIA R0!,{R1-R4}  

                               ;R1<—-[R0]
                               ;R2<—-[R0+4]
                               ;R3<—-[R0+8]
                               ;R4<—-[R0+12]         

例如:

所有的示例指令执行前:
mem32[0x1000C] = 0x04
mem32[0x10008] = 0x03
mem32[0x10004] = 0x02
mem32[0x10000] = 0x01
r0 = 0x00010010
r1 = 0x00000000
r3 = 0x00000000
r4 = 0x00000000
1) ldmia r0!, {r1-r3} 2) ldmib r0!, {r1-r3}
执行后:                      执行后:
r0 = 0x0010001C    r0 = 0x0010001C
r1 = 0x01                   r1 = 0x02
r2 = 0x02                   r2 = 0x03
r3 = 0x03                   r3 = 0x04

2、堆栈寻址:
STMFD入栈指令,相当于STMDB
STMFD SP!,{R2-R4}                            ;[SP-4]<—R4
                                             ;[SP-8]<—R3 
                                             ;[SP-12]<—R2   
LDMFD出栈指令,相当于LDMIA
LDMFD SP!,{R6-R8}                ;R6<—-[SP]
                                 ;R7<—-[SP+4]
                                 ;R8<—-[SP+8]

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/10051.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信