什么EBP和ESP在拆卸code是什么意思? [英] What does ebp and esp in a disassembly code mean?

查看:194
本文介绍了什么EBP和ESP在拆卸code是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面贴是我的code。帮助我理解下面的code的意思:

 推EBP
   MOV EBP,ESP
   子ESP,230H


解决方案

这是一个的函数序言的。

并将旧的基指针到堆栈,因此它可以在以后恢复:

 推EBP

分配堆栈指针的值转换成基指针,那么一个新的堆栈帧将在老栈帧的顶层创建:

  MOV EBP,ESP

通过降低或增加其值(取决于堆栈是否生长向下或向上)进一步移动堆栈指针:

 子ESP,230H

下面,在条230h 立即值是堆栈在功能本地使用上保留的字节数。

在以类似的方式,在函数尾声的反转序幕的行动,并把控制权返回给调用函数。

勾选此相关的SO问题:功能序幕和尾声用C

Below posted is my code. Help me out in understanding what the below code means:

   push    ebp
   mov     ebp, esp
   sub     esp, 230h

解决方案

It is a function prologue.

Pushes the old base pointer onto the stack, so it can be restored later:

   push    ebp

Assigns the value of stack pointer into base pointer, then a new stack frame will be created on top of the old stack frame:

   mov     ebp, esp

Moves the stack pointer further by decreasing or increasing its value (depending on whether the stack grows down or up):

   sub     esp, 230h

Here, the230h immediate value is the number of bytes reserved on the stack for local use in the function.

In a similar way, the function epilogue reverses the actions of the prologue and returns control to the calling function.

Check this related SO question: Function Prologue and Epilogue in C

这篇关于什么EBP和ESP在拆卸code是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆