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 (which is OK – all your program does is terminate), but in DOS it may blow up in your face with various degrees of terribleness.
但我无法理解为什么它会导致分段错误.听起来就像从函数返回一样.
我有一种情况需要实现逻辑“如果X发生,调用程序A.否则,调用程序B.”除了袋鼠编织意大利面条代码之外还有其他方式吗?
解决方法:
因为CALL将当前指令地址压入堆栈,并且RET将其拉出以便返回到调用站点. JMP(和相关指令)不会将任何内容压入堆栈.