分析以下汇编指令片段
- push $8
- movl %esp, %ebp
- pushl %esp
- pushl $8
- addl $4, %esp
- popl %esp
下图不显示具体地址用标号代替,下列例子环境为32位例,堆栈地址偏移为0x4这里用标号代替
0.假设为空栈
1.push $8
将立即数8压入栈中
2.movl %esp,%ebp
ebp = esp
3.pushl %esp
将esp当前指向的地址压入栈中。esp(2)表示标记2的内存地址
4.pushl $8
将立即数8压入栈中
5.addl $4, %esp
esp = (int32_t *)(esp + 4)
6.popl %esp
将栈中的值弹出赋给esp即esp = esp(2)
学习视频: 05_分析几个汇编指令片段(二)