'callq *(%rax)' 是什么意思? [英] What does 'callq *(%rax)' mean?

查看:148
本文介绍了'callq *(%rax)' 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 gdb 会话中分析事后崩溃.我正在查看一个函数的反汇编输出,我看到了这个:

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)

=> 表示这是崩溃时调用的指令.所以我在 *(%rax) 调用函数时遇到了段错误.我对组装很陌生.我看到寄存器周围的括号意味着尊重(获取值)该地址.因此(%rax) 的意思是获取当前存储在%rax 中的指针的值.那星星装饰有什么作用呢?这是否进一步取消引用该值(因此 (%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.

这是从 GCC 4.8 编译 C++ 代码生成的 x64 程序集.

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

推荐答案

星号表示调用是间接调用.这是为了区分call foo(调用函数foo)和call *foo(存储在变量foo中的调用函数).指令 callq *(%rax) 从存储在 rax 中的地址加载一个四字(64 位)并调用从该四字开始的函数.

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.

有关语法的详细信息,请参阅 GNU 汇编器手册.

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

这篇关于'callq *(%rax)' 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆