str的ARM汇编的说明 [英] Explanation of str in ARM assembly
问题描述
奇怪的是,我无法找到一个解释如何 STR
工作在汇编语言。
据我了解,下面...
STR R1,[R2]
...将存储无论是在寄存器1, R1
,在寄存器2的地址, R2
。不过,我想解释何时方括号更为复杂 STR
是如何工作的。例如:
STR R1,[R0,R3,LSL#2]
这是怎么回事?我想知道在哪里 R1
的价值将结束,什么将是它的价值。我无法测试,所以我要采取猜测,我认为是怎么回事。
R3
是逻辑上2.然后将其添加到 R0
移动。最后, R1
添加到 R0
。
这是我的猜测,但即使对我来说这听起来并不正确。有人可以澄清这对我?
STR R1,[R0,R3,LSL#2]
这是怎么回事呢?
块引用>以上基本说明书上说:
R0 +(R3< 2)= R1
,或者如果我们手动扩大的位移位:R0 +(R3 * 4)= R1
该符号是
<&指令GT; <&SRC GT; [< DST&GT中,<偏移GT中,<移>。
注意,偏移量也可以是负的(例如
-R3,#LSL2
)。
我想知道其中,r1的值将结束,并且会是什么其值
块引用>您需要知道的实际值
R0
和R3
在一次执行过程之前的特定点你可以知道这些。这就像问什么是是
在值Y = F(X):X * 2
不知道关于什么X
。
R3是逻辑上通过2.然后将其加入到r0的移
块引用>是
最后,R1被添加到r0的
块引用>在基准
R1
是存储的中(未加入)由左手侧计算出的位置。Strangely, I cannot find an explanation as to how
str
works in assembly language.I understand that the following...
str r1,[r2]
...will store whatever is in register 1,
r1
, in the address of register 2,r2
. However, I would like an explanation as to howstr
works when the square brackets are much more complicated. For example:str r1,[r0,r3,lsl#2]
What is going on here? I want to know where the value of
r1
will end up, and what will be its value. I can't test it, so I am going to take a guess as to what I think is going on.
r3
is logically shifted by 2. It is then added tor0
. Finally,r1
is added tor0
.This is my guess, though even to me this does not sound correct. Can someone clarify this for me?
解决方案
str r1,[r0,r3,lsl#2]
What is going on here?
The instruction above basically says:
r0 + (r3 << 2) = r1
, or if we manually "expand" the bit-shift:r0 + (r3 * 4) = r1
The notation is
<instruction> <src> [<dst>, <offset>, <shift>]
.Note that offsets can also be negative (e.g.
-r3, #lsl2
).I want to know where the value of r1 will end up, and what will be its value.
You need to know the actual values of
r0
andr3
at a specific point in time during its execution before you can know any of this. This is like asking "What is the value ofy
iny = f(x) : x * 2
?" without knowing anything aboutx
.r3 is logically shifted by 2. It is then added to r0.
Yes.
Finally, r1 is added to r0.
The datum in
r1
is stored in (not added to) the location calculated by the left-hand side.这篇关于str的ARM汇编的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!