本文介绍了手臂组件中的 movw 和 movt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法破译这块汇编代码.到最后 r1 的价值是多少,我将如何到达那里?

I'm having trouble deciphering this block of assembly code. What would the value of r1 be by the end and how would I get there?

3242ba66    f6454118    movw    r1, 0x5c18
3242ba6a        466f    mov     r7, sp
3242ba6c    f6c0415a    movt    r1, 0xc5a
3242ba70    f2460002    movw    r0, 0x6002
3242ba74    f6c0405a    movt    r0, 0xc5a
3242ba78        4479    add     r1, pc
3242ba7a        4478    add     r0, pc
3242ba7c        6809    ldr     r1, [r1, #0]

推荐答案

movw 后跟 movt 是将 32 位值加载到寄存器中的常用方法.这相当于将这两个立即数进行 OR 运算,其中 movt 是高 16 位.在这种情况下,r1 = (movt 立即数 <.

movw followed by a movt is a common way to load a 32-bit value into a register. It's the equivalent of OR-ing those two immediate values together, with the movt being the upper 16-bit. In this case, r1 = (movt immediate value << 16) | (movw immediate value)).

3242ba66    f6454118    movw    r1, 0x5c18   // r1 = 0x5c18
3242ba6a        466f    mov     r7, sp
3242ba6c    f6c0415a    movt    r1, 0xc5a    // r1 = (r1 & 0xffff) | (0xc5a << 16)
3242ba70    f2460002    movw    r0, 0x6002
3242ba74    f6c0405a    movt    r0, 0xc5a
3242ba78        4479    add     r1, pc       // r1 = r1 + pc
3242ba7a        4478    add     r0, pc
3242ba7c        6809    ldr     r1, [r1, #0] // r1 = *(r1 + 0)

这篇关于手臂组件中的 movw 和 movt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 06:57