开发者

How program counter is manipulated in powerpc assembler

开发者 https://www.devze.com 2023-04-05 00:39 出处:网络
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 o

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 开发者_如何学C    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!


. sets the current location counter as you rightly guessed. In your example you have set the location counter to main()+0x100, i.e. 0x100003dc+0x100 = 0x100004dc. There will be no valid instructions after the instruction at 0x100003e4 up to address 0x100004dc however (you would normally be branching here).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号