了解ARM中的str

时间:2016-02-03 20:17:05

标签: assembly arm

我有以下汇编代码:

 exec sp_executesql N'update customer set status=''B'' 
where custid=@custID',N'@custID bigint',@custID=940

我知道很多,但我只有一部分有问题。我评论了我知道的部分,或者至少我认为我知道。

我遇到的问题是alpha: .space 64 @reserves 64 bytes i: int 0 .text .align2 .globalmain .func main main: ldr r3,=i @r3 is address of i mov r2,#0 @r2 is 0 str r2,[r3] @r2 is stored in r3 L1: ldr r3,=i @r2 is address of i ldr r2,[r3] @r2 is now address of i cmp r2,#16 bge exit @if r2 > 16, then exit (but it is not) ldr r3,=i @r3 is address of i ldr r2,[r3] @r2 is address of i add r1,r2,#0x200 @r1 is r2 + 0x200 ldr r3,=alpha @r3 is address of first element in array alpha (I think) str r1,[r3,r2,asl#2] ... 。我知道str r1,[r3,r2,asl#2]是左移,但这是我真正知道的。在r3中r1存储在哪里? asl#2命令的结果是什么?有人可以帮我解释一下吗?

1 个答案:

答案 0 :(得分:1)

str r1,[r3,r2,asl#2]

r2中的值是左移的(立即值)2,并被添加到r3的内容中,以获得将存储r1的存储器地址。