可以在Linux上的代码中使用BIOS中断吗? [英] Possible to use bios interrupts in your code on linux?

查看:211
本文介绍了可以在Linux上的代码中使用BIOS中断吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux中使用汇编语言编写了一个简单程序(使用nasm),出于教育目的,我想使用BIOS中断代替linux系统调用,这可能吗?

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 ?

推荐答案

最简单的答案是,不可能.

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

更长的答案是Linux支持virtual8086模式(int vm86(unsigned long fn, struct vm86plus_struct *v86)调用),该模式能够执行实模式代码(包括BIOS功能,如果设置正确的话).然而; BIOS期望许多不同的硬件处于特定/默认状态,Linux(像所有好的OS一样)控制硬件并将其置于BIOS可能无法期望的各种状态.因此,可能可以调用BIOS函数,但是您可以期望它们崩溃,导致未知行为和/或破坏Linux本机设备驱动程序的正常运行.

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.

还请注意,无论如何,BIOS功能绝对不如" Linux的本地设备驱动程序(换句话说,如果它确实起作用,您仍然不应该这样做);现在许多系统都使用UEFI(在这种情况下BIOS功能根本不存在).

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).

这篇关于可以在Linux上的代码中使用BIOS中断吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆