我正在编写实模式函数,它应该是带有堆栈帧等的正常函数,但它应该使用 %sp 而不是 %esp。有什么办法吗?
最佳答案
GCC 5.2.0(以及可能的更早版本)支持使用 -m16
标志生成 16 位代码。但是,代码几乎肯定会依赖 32 位处理器功能(例如 32 位宽寄存器),因此您应该仔细检查生成的程序集。
来自 man
页面:
The -m16 option is the same as -m32, except for that it outputs the ".code16gcc" assembly directive at the beginning of the assembly output so that the binary can run in 16-bit mode.
关于c - 如何告诉 GCC 为实模式生成 16 位代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19055647/