Possible to use bios interrupts in your code on linux?

流过昼夜 提交于 2019-12-10 17:12:26

问题


I write a simple program in assembly language in Linux (using nasm), and for educational purposes, I want to use BIOS interrupt instead linux system calls, is this possible ?


回答1:


The short answer is, no it's not possible.

The longer answer is that Linux has support for virtual8086 mode (the int vm86(unsigned long fn, struct vm86plus_struct *v86) call) which is capable of executing real mode code (including BIOS functions, if setup properly). However; the BIOS expects lots of different pieces of hardware to be in specific/default states, and Linux (like all good OSs) takes control of the hardware and puts it all in various state/s that the BIOS can't possibly expect. Because of this it might be possible to call the BIOS functions, but you can expect them to crash, cause unknown behaviour and/or ruin the proper functioning of Linux's native device drivers.

Also note that the BIOS functions are "extremely inferior" to Linux's native device drivers anyway (or in other words, if it actually did work, you still shouldn't do it); and a lot of systems use UEFI now (the BIOS functions simply do not exist in that case).




回答2:


You could assemble for a DOS environment and use DOSBox to run it from Linux. Or, you could write it for no OS (bootloader) and run inside of VirtualBox.



来源:https://stackoverflow.com/questions/23338332/possible-to-use-bios-interrupts-in-your-code-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!