ARF*_*ARF 2 memory embedded assembly processor xtensa
我正在尝试阅读一些 xtensa 汇编代码,但被 L32R指令:
例如,给出以下行:
0000 2f04 <my_func>:
2f0c: ffef21 l32r a2, 2ec8
Run Code Online (Sandbox Code Playgroud)
这会加载哪个地址?
该的Xtensa指令集架构参考手册,对于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.
Run Code Online (Sandbox Code Playgroud)
所以继续上面的例子; 常量的操作:
ffef 16-bit constant
ffff ffef 16-bit constant one-extended
ffff ffbc shifted left by two
Run Code Online (Sandbox Code Playgroud)
电脑操作:
0000 2f0c program counter
0000 2f0f pc +3
0000 0f0c masked bits 0 and 1
Run Code Online (Sandbox Code Playgroud)
虚拟地址的计算:
ffff ffbc
+ 0000 2f0c
===========
1 0000 2ec8
Run Code Online (Sandbox Code Playgroud)
因此丢弃 16 位以外的所有内容: 2ec8