首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xtensa指令: L32R -哪个地址被加载?

Xtensa指令: L32R -哪个地址被加载?
EN

Stack Overflow用户
提问于 2015-01-15 15:44:35
回答 2查看 2.4K关注 0票数 2

我正在尝试阅读一些xtensa程序集代码,并被L32R指令所困扰:

例如,考虑到以下一行:

代码语言:javascript
复制
0000 2f04 <my_func>:
     2f0c:  ffef21          l32r    a2, 2ec8

这个地址是哪一个?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-01-16 10:43:38

Xtensa指令集架构参考手册手册在第382页中指出,l32r的地址计算如下:

代码语言:javascript
复制
L32R forms a virtual address by adding the 16-bit one-extended constant value encoded
in the instruction word shifted left by two to the address of the L32R plus three with the
two least significant bits cleared. Therefore, the offset can always specify 32-bit aligned
addresses from -262141 to -4 bytes from the address of the L32R instruction. 32 bits
(four bytes) are read from the physical address.

所以在继续上面的例子中;对常量的操作:

代码语言:javascript
复制
     ffef    16-bit constant
ffff ffef    16-bit constant one-extended
ffff ffbc    shifted left by two

操纵个人电脑:

代码语言:javascript
复制
0000 2f0c    program counter
0000 2f0f    pc +3
0000 0f0c    masked bits 0 and 1

虚拟地址的计算:

代码语言:javascript
复制
  ffff ffbc
+ 0000 2f0c
===========
1 0000 2ec8

所以丢弃16位以外的所有东西:2ec8

票数 5
EN

Stack Overflow用户

发布于 2016-05-29 05:42:26

L32R指令从指定地址加载32位值.因此,"l32r a2,2ec8“将位于地址0x2ec8的32位值加载到寄存器a2中。你得看看你拆卸时的位置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27967289

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档