手臂组件中的 movw 和 movt

编程入门 行业动态 更新时间:2024-10-25 14:23:18
本文介绍了手臂组件中的 movw 和 movt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我无法破译这块汇编代码.到最后 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 立即数 <<16) |(movw 立即数)).

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-16 15:04:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/889077.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:手臂   组件   movt   movw

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!