gcc, inline assembly - pushad/popad missing?

2019-02-26 15:49发布

Any way to avoid having to copy-paste the pushad/popad instruction body into my code?

Because gcc (current flags: -Wall -m32) complains that

__asm__("pushad;");

Error: no such instruction: `pushad'

__asm__("popad;");

Error: no such instruction: `popad'

1条回答
SAY GOODBYE
2楼-- · 2019-02-26 16:15

GCC use AT/T assembly syntax, while pushad/popad are Intel convention, try this:

__asm__("pushal;");
__asm__("popal;");
查看更多
登录 后发表回答