什么是汇编栈帧? [英] What is stack frame in assembly?

查看:268
本文介绍了什么是汇编栈帧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是堆栈帧的结构和它是如何,而在装配调用函数使用吗?

What is the structure of a stack frame and how is it used while calling functions in assembly?

推荐答案

在X86-32堆栈帧执行创建

The x86-32 stack frame is created by executing

function_start:
    push ebp
    mov ebp, esp

所以它是通过访问EBP,看起来像

so it's accessible through ebp and looks like

ebp+00 (current_frame) : prev_frame
ebp+04                 : return_address
                         ....
prev_frame             : prev_prev_frame
prev_frame+04          : prev_return_address

有使用是由汇编指令的设计栈帧的EBP的一些优点,所以参数和当地人通常用EBP寄存器访问。

There is some advantages of using ebp for stack frames by assembly instruction design, so arguments and locals usually are accessed using ebp register.

这篇关于什么是汇编栈帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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