x64 汇编函数(调用/返回与推送/弹出/跳转) [英] x64 assembly functions (call/return vs push/pop/jump)

查看:43
本文介绍了x64 汇编函数(调用/返回与推送/弹出/跳转)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用内置调用和返回指令与手动推入和弹出堆栈以及使用函数跳转有什么区别?

Whats the difference between using the built-in call and return instructions vs manually pushing and popping the stack and using jumps for functions?

推荐答案

在功能上,如果你做对了,什么都没有.然而,使用 push/pop 模拟 call/ret 需要更多的指令和/或寄存器.当然,如果你真的想把它发挥到极致,你也可以使用leamovpush/pop代码> :)

Functionally, if you do it correctly, nothing. However it takes more instructions and/or registers to emulate call/ret using push/pop. Of course if you really wanted to take it to the extreme, you could also emulate push/pop using lea and mov :)

此外,当前的处理器具有专门的硬件来处理用于分支预测的函数调用,这可能不适用于您的替代序列,因此您会受到性能损失.

Also, current processors have specialized hardware to handle function calls for the purposes of branch prediction, which probably won't work for your alternate sequence so you will get performance penalty.

这篇关于x64 汇编函数(调用/返回与推送/弹出/跳转)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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