Assembly Xtensa指令:L32R-加载了哪个地址?

Assembly Xtensa指令:L32R-加载了哪个地址?,assembly,memory,embedded,processor,xtensa,Assembly,Memory,Embedded,Processor,Xtensa,我试图阅读一些xtensa汇编代码,但被L32R指令难住了: 例如,给定以下行: 0000 2f04 <my_func>: 2f0c: ffef21 l32r a2, 2ec8 0000 2f04: 2f0c:ffef21 l32r a2,2ec8 此加载哪个地址?手册第382页规定,对于l32r地址的计算如下: L32R forms a virtual address by adding the 16-bit one-extended con

我试图阅读一些xtensa汇编代码,但被
L32R
指令难住了:

例如,给定以下行:

0000 2f04 <my_func>:
     2f0c:  ffef21          l32r    a2, 2ec8
0000 2f04:
2f0c:ffef21 l32r a2,2ec8
此加载哪个地址?

手册第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

L32R指令从指定地址加载32位值。因此“l32r a2,2ec8”将地址0x2ec8处的32位值加载到寄存器a2中。您必须在反汇编中查看该位置。

您链接到的文档的第382页有更详细的描述。Michael的评论包含在下面的答案中。为什么您的示例2f0c中的PC值是2f04,而原始示例中的PC值是2f04?如果这看起来很明显,很抱歉,但我是MCU的初学者,试图调试一个“致命异常(0)”,显然是由ESP8266上的l32r引起的。@MichaelBöckling我相信在最初的问题中,我手动“简化”了反汇编,并在这个过程中更改了偏移量。它应该是
2f0c
而不是
2f04
。我现在修正了原来的问题。