str的ARM汇编的说明 [英] Explanation of str in ARM assembly

查看:296
本文介绍了str的ARM汇编的说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的是,我无法找到一个解释如何 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; [< D​​ST&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 how str 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 to r0. Finally, r1 is added to r0.

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 and r3 at a specific point in time during its execution before you can know any of this. This is like asking "What is the value of y in y = f(x) : x * 2?" without knowing anything about x.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆