什么是论点推秩序 [英] What is argument push order

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

问题描述

我在学习汇编语言。究竟是什么推说法秩序?我明白它的参数是如何压入堆栈但到底是什么的左边和右边的部分是什么意思?左侧或右侧是什么?
还是这仅仅是用命令在语义表述方式,即做到:

I'm learning Assembly language. What exactly is argument push order? i understand its how arguments are pushed to the stack but what does the left and right part mean? left or right of what? Or is this merely to do with the way the command is semantically written, i.e.:

MOV EBP,ESP; ESP移动到EBP,从右至左

mov ebp, esp ;esp is moved into ebp, right to left.

这是正确的或可能有人告诉我吗?

Is this correct or could someone enlighten me?

非常感谢!

推荐答案

该处理器是没有'函数参数。因此,当你想要写 F(A,B,C),你真的需要推动的论点'地方'。

The processor knows no 'function arguments'. Therefore when you want to write f(a,b,c), you really need to push the arguments 'somewhere'.

这是惯例。我知道,在大多数x86机器,函数参数都被压入堆栈从右到左,即第一个C,然后是B,那么。

This is convention. I know that on most x86 machines, function arguments are pushed on the stack from right to left, i.e. first c, then b, then a.

push c
push b
push a
call f

现在被调用函数可以使用 EBX -1 EBX - 2 为b和 EBX - 3 对于C

Now the called function can use ebx -1 for a, ebx - 2 for b and ebx - 3 for c.

您可以同时建立一个约定,说:前两个参数是在寄存器 EBX ECX ,休息是在堆栈中。只要调用者和被调用者同意,你的罚款。

You could as well establish a convention that says: first two arguments are in registers ebx and ecx, rest are on the stack. As long as the caller and callee agree, you're fine.

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

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