小编no0*_*now的帖子

局部变量从堆栈基指针偏移

我想了解更多有关堆栈和基指针的信息.以下示例汇编代码来自IA32上由gcc编译的二进制文件的objdump.

08048e0b <func_3>:
8048e0b:    55                      push   %ebp
8048e0c:    89 e5                   mov    %esp,%ebp
8048e0e:    83 ec 28                sub    $0x28,%esp
8048e11:    8d 45 f0                lea    -0x10(%ebp),%eax
8048e14:    89 44 24 0c             mov    %eax,0xc(%esp)
8048e18:    8d 45 f4                lea    -0xc(%ebp),%eax
8048e1b:    89 44 24 08             mov    %eax,0x8(%esp)
8048e1f:    c7 44 24 04 65 9b 04    movl   $0x8049b65,0x4(%esp)
Run Code Online (Sandbox Code Playgroud)

我知道基指针%ebp用于引用函数参数和局部变量.通常,正偏移是传递给函数的参数,负偏移是局部变量?

在线8048e18: 8d 45 f4 lea -0xc(%ebp),%eax什么是-0xc(%ebp)指的是什么?

c x86 assembly

5
推荐指数
1
解决办法
3083
查看次数

标签 统计

assembly ×1

c ×1

x86 ×1