ARM 调试时的DIsassembly窗口的汇编,LDR, MOV,STR

在这里插入图片描述
1、ARM是RISC结构,数据从内存到CPU(寄存器)之间的移动LDR/STR指令。
LDR r0, 0x12345678 就是把0x12345678这个地址中的值存放到r0中。
LDR r0,[pc,#48]; 从pc+48存储器取出数据—>存到r0中

2、STR r0,[r1,#0x00] 将r0中的数据写入 r1+0x00 的存储器中

3、MOV r0,#0x1c200 给寄存器r0一个立即数 0x1c200;如果是MOVS指令,则会影响CPSR(当前程序状态寄存器)中的标志位:N位 结果是否为负数,C位:进位移位借位溢出位 V位:overflow位 Z位:结果是否为0

以下说到MOV的立即数不能大于255,但是上面的0x1c200明显大于255,不知为何
参考:https://blog.csdn.net/czxyhll/article/details/7853807

Question on MOV
Does the instruction “Mov” have indirect addressing?
Answer. No, e.g. you cannot use mov r1,[r2] 
“MOV loads a value into the destination register, from another register, a shifted register, or an immediate 8-bit value.”

Examples:
  MOV R0, R1 if R1 has 0x00001234, after this ,R1=R2=0x00001234
  MOV R0, #0x12; after this R0 has #0x12
  MOV R0, #300; is wrong the value should be less than 255
  MOV R0, 200; is wrong, # is missing “mov R0,#200: is correct

Note: the immediate value must be prefixed by #

从上面的描述可以看出,mov的作用有两个:

  1. 在寄存器之间传递值。

  2. 给寄存器传递一个立即数,此时需要用“#”来修饰立即数,并且立即数为8位的,其值不能超过255.

但是在vivi中的head.S里,有许多类似 mov r1, #0x53000000 的语句:

猜你喜欢

转载自blog.csdn.net/liangbin414/article/details/88565688
今日推荐