|
|
|
|
 关于反汇编的问题 - websurf [ 2006-07-27 11:39 | 1,733 byte(s)]
 Re: 关于反汇编的问题 - grip2 [ 2006-07-27 14:11 | 375 byte(s)]
 Re: 关于反汇编的问题 - websurf [ 2006-07-27 17:05 | 9 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
编译器为gcc-4.0.0
将下面的C代码
//test.c
int main()
{
return 0;
}
编译链接
gcc -o test test.c
反汇编test. main函数部分的汇编代码如下:
08048348 <main>:
8048348: 55 push %ebp
8048349: 89 e5 mov %esp,%ebp
804834b: 83 ec 08 sub $0x8,%esp
804834e: 83 e4 f0 and $0xfffffff0,%esp
8048351: b8 00 00 00 00 mov $0x0,%eax
8048356: 83 c0 0f add $0xf,%eax
8048359: 83 c0 0f add $0xf,%eax
804835c: c1 e8 04 shr $0x4,%eax
804835f: c1 e0 04 shl $0x4,%eax
8048362: 29 c4 sub %eax,%esp
8048364: b8 00 00 00 00 mov $0x0,%eax
8048369: c9 leave
804836a: c3 ret
804836b: 90 nop
请问:
(1) 主函数为什么要分配8字节的栈?
(2) 这段汇编是干什么用的:
804834e: 83 e4 f0 and $0xfffffff0,%esp
8048351: b8 00 00 00 00 mov $0x0,%eax
8048356: 83 c0 0f add $0xf,%eax
8048359: 83 c0 0f add $0xf,%eax
804835c: c1 e8 04 shr $0x4,%eax
804835f: c1 e0 04 shl $0x4,%eax
8048362: 29 c4 sub %eax,%esp
多谢!
|
|
|
[Original]
[Print]
[Top]
|
|
|