繁体   English   中英

关于AT&T汇编语法(%esp,1)

[英]about AT&T assembly syntax (%esp,1)

当我阅读一些反汇编代码时,因为我不熟悉AT&T语法,所以我不知道像(%esp,1)这样的代码的含义。

11      printf("%x", a);
0x401386        <main+182>:    movl  $0x1,0x4(%esp,1)
0x40138e        <main+190>:    movl  $0x40300d,(%esp,1)
0x401395        <main+197>:    call  0x401810 <printf>

有人可以告诉我这是什么意思吗? 谢谢!

                              ; Decompiled, sort of, back to C
                              ; ==============================
    movl  $0x1,0x4(%esp,1)    ; %esp[1] = 1 (the "1" really means, "add 4")
    movl  $0x40300d,(%esp,1)  ; %esp[0] = "%x"
    call  0x401810 <printf>   ; push return address and branch to printf

似乎编译器知道a等于1 ,并且它已经向下调整了堆栈指针以为参数留出空间。 也许它结合了函数序言将空间压入堆栈。

通常,寻址模式如下所示:

r    ; register
(r)  ; memory, register contains the address
8(r) ; memory, displacement of 8 off the register

该Wikibook似乎具有有关GNU汇编程序及其AT&T语法的一些信息:

http://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax

我还找到了有关Gas的以下两个文档来源,但它们似乎不太清楚或没有用:

  1. http://webster.cs.ucr.edu/AsmTools/Gas/GasDoc/as_toc.html
  2. http://sourceware.org/binutils/docs-2.17/as/index.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM