小编gum*_*hew的帖子

和esp,0xfffffff0

我不完全理解下面的注释内容.我在SO和gcc手册中阅读了一些帖子,并了解到它是用于堆栈地址对齐但却无法理解它是如何做到的.代码如下所示:

(gdb) disas main
Dump of assembler code for function main:
   0x08048414 <+0>: push   ebp
   0x08048415 <+1>: mov    ebp,esp
   0x08048417 <+3>: and    esp,0xfffffff0 ; why??
   0x0804841a <+6>: sub    esp,0x10
   0x0804841d <+9>: mov    DWORD PTR [esp],0x8048510
   0x08048424 <+16>:    call   0x8048320 <puts@plt>
   0x08048429 <+21>:    mov    DWORD PTR [esp],0x8048520
   0x08048430 <+28>:    call   0x8048330 <system@plt>
   0x08048435 <+33>:    leave
   0x08048436 <+34>:    ret
End of assembler dump.
Run Code Online (Sandbox Code Playgroud)

代码是gcc在linux上使用(版本4.6.3)生成的.谢谢.

x86 assembly

16
推荐指数
3
解决办法
6680
查看次数

标签 统计

assembly ×1

x86 ×1