gpt4 book ai didi

assembly - 在 Win64 ABI 中,保留的参数堆栈空间可以用于通用存储吗?

转载 作者:行者123 更新时间:2023-12-04 11:59:01 27 4
gpt4 key购买 nike

我正在 Windows 上学习 x64 程序集以获得“乐趣”。 MSDN documentation for the x64 calling convention on Windows说:

The caller is responsible for allocating space for parameters to the callee, and must always allocate sufficient space for the 4 register parameters, even if the callee doesn’t have that many parameters. This aids in the simplicity of supporting C unprototyped functions, and vararg C/C++ functions.



由于我的函数不是 C 非原型(prototype)函数或可变参数 C/C++ 函数,这是否意味着我始终可以使用 [rsp+8][rsp+32] (假设调用后的 rsp 的未修改值)用于我的函数中的通用存储,例如局部变量?

最佳答案

是的,您可以将入站参数暂存空间用于任何目的。但是您已经知道这一点:修改入站参数的合法性已经暗示了这样做的权限。

void somefunction(int arg1)
{
arg1 = anyvalue; // mov [rsp+8], anyvalue
}

关于assembly - 在 Win64 ABI 中,保留的参数堆栈空间可以用于通用存储吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7138347/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com