【问题标题】:gcc, inline assembly - pushad/popad missing?gcc,内联汇编 - 缺少 pushad/popad?
【发布时间】:2016-09-06 13:18:43
【问题描述】:

有什么方法可以避免将pushad/popad 指令体复制粘贴到我的代码中?

因为 gcc(当前标志:-Wall -m32)抱怨

__asm__("pushad;");

错误:没有这样的指令:`pushad'

__asm__("popad;");

错误:没有这样的指令:`poppad'

【问题讨论】:

  • 仅供参考,如果需要,让编译器保存/恢复寄存器几乎总是更好。使用约束来告诉它你想要破坏哪些 regs,或者更好:让它为你挑选临时 regs。请参阅the x86 tag wiki中的内联 asm 链接

标签: c gcc assembly stack inline-assembly


【解决方案1】:

GCC 使用 AT/T 汇编语法,而 pushad/popad 是 Intel 约定,试试这个:

__asm__("pushal;");
__asm__("popal;");

【讨论】:

    猜你喜欢
    • 2012-10-20
    • 1970-01-01
    • 1970-01-01
    • 2011-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-11
    • 2015-12-23
    相关资源
    最近更新 更多