assembly - Xtensa指令: L32R - which addres is loaded?

标签 assembly memory embedded processor xtensa

我正在尝试读取一些 xtensa 汇编代码,但被 L32R 指令难住了:

例如给定以下行:

0000 2f04 <my_func>:
     2f0c:  ffef21          l32r    a2, 2ec8

加载哪个地址?

最佳答案

Xtensa Instruction Set Architecture Reference Manual手册第 382 页指出,对于 l32r,地址计算如下:

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.

所以继续上面的例子;常数的处理:

     ffef    16-bit constant
ffff ffef    16-bit constant one-extended
ffff ffbc    shifted left by two

电脑操作:

0000 2f0c    program counter
0000 2f0f    pc +3
0000 0f0c    masked bits 0 and 1

虚拟地址的计算:

  ffff ffbc
+ 0000 2f0c
===========
1 0000 2ec8

因此丢弃 16 位以外的所有内容:2ec8

关于assembly - Xtensa指令: L32R - which addres is loaded?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27967289/

相关文章:

c - 操作控制寄存器

c# - 我的(巨大的)应用程序抛出了 OutOfMemoryException,现在怎么办?

java - Java使用的内存多于堆大小(或正确大小的Docker内存限制)

linux - Openfire Java 内存

c - C 标准是否对使用的堆栈空间量有任何保证?

c - 使用中断处理程序时如何避免使用全局变量?

gcc - 现代编译器如何使用 mmx/3dnow/sse 指令?

assembly - MIPS lui指令的word格式如何?

performance - perf record(或其他分析器)如何选择将哪个指令计为花费时间?

c - 这个 GCC 错误 "... relocation truncated to fit..."是什么意思?