What does 'callq *(%rax)' mean?

混江龙づ霸主 提交于 2021-01-27 18:53:56

问题


I'm in a gdb session to analyze a postmortem crash. I'm looking at disassemble output for a function and I see this:

=> 0x00007f8d354aed52 <+50>:    callq  *(%rax)

The => indicates that this was the instruction called at the time of the crash. So I got a seg fault calling the function at *(%rax). I'm pretty new to assembly. I see that parens around a register mean to deference (get the value at) that address. Thus (%rax) means to get the value of the pointer currently stored in %rax. What does the star decoration do on that? Does that further dereference that value (thus (%rax) is itself a pointer)? I'm having trouble googling *( assembly syntax.

This is x64 assembly generated from GCC 4.8 compiling C++ code.


回答1:


The asterisk indicates that the call is an indirect call. This is to distinguish call foo (call function foo) from call *foo (call function stored in variable foo). The instruction callq *(%rax) loads a quad word (64 bits) from the address stored in rax and calls the function beginning at that quad word.

Refer to the GNU assembler manual for details on the syntax.



来源:https://stackoverflow.com/questions/56979796/what-does-callq-rax-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!