zoukankan      html  css  js  c++  java
  • 【转】ret,retf,iret的区别

    ret

    RET, and its exact synonym RETN, pop IP or EIP from the stack and transfer control to the new address. Optionally, if a numeric second operand is provided, they increment the stack pointer by a further imm16 bytes after popping the return address.
    

    ret:也可以叫做近返回,即段内返回。处理器从堆栈中弹出IP或者EIP,然后根据当前的CS:IP跳转到新的执行地址。如果之前压栈的还有其余的参数,则这些参数也会被弹出。

    retf

    RETF executes a far return: after popping IP/EIP, it then pops CS, and then increments the stack pointer by the optional argument if present.
    

    retf:也叫远返回,从一个段返回到另一个段。先弹出堆栈中的IP/EIP,然后弹出CS,有之前压栈的参数也会弹出。(近跳转与远跳转的区别就在于CS是否压栈。)

    iret

    IRET returns from an interrupt (hardware or software) by means of popping IP (or EIP), CS and the flags off the stack and then continuing execution from the new CS:IP.
    

    iret:用于从中断返回,会弹出IP/EIP,然后CS,以及一些标志。然后从CS:IP执行。

    来源:https://linux.cn/blog-11720-5748.html

  • 相关阅读:
    关于我的介绍
    关于这周的作业
    关于这周的学习
    每周学习
    关于这周程序设计
    关于这周的总结
    关于这周的学习
    随机抽签程序报告
    Mysql的主从复制原理及部署
    项目架构脚本
  • 原文地址:https://www.cnblogs.com/litlife/p/7512767.html
Copyright © 2011-2022 走看看