如何在 powerpc 汇编器中操作程序计数器
powerpc汇编器中这条指令的结果是什么?
. = 0x100
我认为这涉及程序计数器,但是反汇编使用该指令的可执行文件,输出中会出现奇怪的情况。 这是简单的代码:
int main()
{
__asm__(". = 0x100");
return 0;
}
这是反汇编的代码:
$ gcc -o prog main.c
$ objdump -d prog
[...]
100003dc <main>:
100003dc: 94 21 ff f0 stwu r1,-16(r1)
100003e0: 93 e1 00 0c stw r31,12(r1)
100003e4: 7c 3f 0b 78 mr r31,r1
...
100004dc: 38 00 00 00 li r0,0
100004e0: 7c 03 03 78 mr r3,r0
100004e4: 81 61 00 00 lwz r11,0(r1)
100004e8: 83 eb ff fc lwz r31,-4(r11)
100004ec: 7d 61 5b 78 mr r1,r11
100004f0: 4e 80 00 20 blr
[...]
该指令出现了三个点。它们的意义是什么? GAS 是如何分析这一点的?
谢谢大家!
What is the result of this instruction in powerpc assembler?
. = 0x100
I think this involves program counter but disassembling an executable that uses this instruction something strange in output occurs.
This is the simple code:
int main()
{
__asm__(". = 0x100");
return 0;
}
and this is the disassembled code:
$ gcc -o prog main.c
$ objdump -d prog
[...]
100003dc <main>:
100003dc: 94 21 ff f0 stwu r1,-16(r1)
100003e0: 93 e1 00 0c stw r31,12(r1)
100003e4: 7c 3f 0b 78 mr r31,r1
...
100004dc: 38 00 00 00 li r0,0
100004e0: 7c 03 03 78 mr r3,r0
100004e4: 81 61 00 00 lwz r11,0(r1)
100004e8: 83 eb ff fc lwz r31,-4(r11)
100004ec: 7d 61 5b 78 mr r1,r11
100004f0: 4e 80 00 20 blr
[...]
With that instruction there are appeared three dots. What is the meaning of them? How does the GAS traduce this?
Thank you all!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.
设置当前位置计数器,正如您所猜对的那样。在您的示例中,您已将位置计数器设置为main()+0x100
,即0x100003dc+0x100 = 0x100004dc
。然而,在0x100003e4
处的指令之后到地址0x100004dc
之间不会有任何有效指令(您通常会在此处分支)。.
sets the current location counter as you rightly guessed. In your example you have set the location counter tomain()+0x100
, i.e.0x100003dc+0x100 = 0x100004dc
. There will be no valid instructions after the instruction at0x100003e4
up to address0x100004dc
however (you would normally be branching here).