assembly - iret 和 iretd,iretq 和有什么不一样?

标签 assembly linux-kernel x86

我想在 Linux x86_64 服务器上模拟 iret 条件。
我发现有三个指令

  • iret:操作数大小 16
  • iretd:操作数大小 32
  • iretq:操作数大小 64

  • 我无法分辨它们的区别,以及使用哪一种。
    感谢任何人的帮助!!

    我还有一个关于模拟 iret 的问题,你可以看看吗?http://stackoverflow.com/questions/11756274/how-to-simulate-a-iret-on-linux-x86-64

    最佳答案

    从这里 link :

    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.

    IRETW pops IP, CS and the flags as 2 bytes each, taking 6 bytes off the stack in total. IRETD pops EIP as 4 bytes, pops a further 4 bytes of which the top two are discarded and the bottom two go into CS, and pops the flags as 4 bytes as well, taking 12 bytes off the stack.

    IRET is a shorthand for either IRETW or IRETD, depending on the default BITS setting at the time.



    IRETQ 也非常相似

    关于assembly - iret 和 iretd,iretq 和有什么不一样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11756153/

    相关文章:

    assembly - x86 jmp 注册

    c - Linux 外壳代码 "Hello, World!"

    shell - 更多无空Shellcode

    linux - 你会为什么编写内核模块?

    x86 - AVX 或 SSE 上的水平尾随最大值

    assembly - 为什么在这个简单的程序中,与 C++ 相比,gfortran 会产生如此大的堆栈大小?

    c - Linux 内核未将完整结构传递给 sysfs 回调

    java - NFS 客户端锁定当前正在远程 NFS 服务器中写入的文件

    c - 为什么更多的 x86 指令比更少的更快?

    assembly - 段寄存器的汇编程序使用