linux – 汇编:为什么跳转到通过ret返回的标签会导致分段错误?
发布时间:2020-12-13 23:50:38 所属栏目:Linux 来源:网络整理
导读:Linux Assembly Tutorial州: there is one very important thing to remember: If you are planning to return from a procedure (with the RET instruction),don’t jump to it! As in “never!” Doing that will cause a segmentation fault on Linux (w
Linux Assembly Tutorial州:
但我无法理解为什么它会导致分段错误.听起来就像从函数返回一样. 我有一种情况需要实现逻辑“如果X发生,调用程序A.否则,调用程序B.”除了袋鼠编织意大利面条代码之外还有其他方式吗? 解决方法
因为CALL将当前指令地址压入堆栈,并且RET将其拉出以便返回到调用站点. JMP(和相关指令)不会将任何内容压入堆栈.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |