Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling bios int 10h from kernel module

140 views
Skip to first unread message

Fungolino

unread,
Sep 23, 2002, 4:28:09 AM9/23/02
to
I am writing a very simple kernel module to switch the video output
from CRT to TV and viceversa using an extended int 10h bios call.
This bios call is specific to the industrial motherboard I am using.

Whenever the module decides to switch the video output, it performs
the bios call with the following code (gcc):

__asm__ ("
movw $0x5F22, %ax
xor %bx, %bx
int $0x10
");

The module loads and unload fine, but whenever the previous code is
executed, I get a floating point exception error.
The floating point exception error is caused by the int $0x10 call
(commenting it out from the previous asm call the error disappears).

Is there anybody out there willing to help me out?
I would reeeeally apreciate it!

Thank you
Rodolfo Saccani

Robert Kaiser

unread,
Sep 23, 2002, 5:25:21 AM9/23/02
to
In article <fb27a689.02092...@posting.google.com>,

You can't just call BIOS functions from Linux like that. Linux runs
in protected mode while the BIOS expects the CPU to be in real mode.

However, I have seen some code before that does just what you want
(switch video modes by making BIOS calls). I can't remember exactly
how it worked (maybe it used virtual x86 mode). I forgot the URL
though (sorry), but maybe someone else has it.

Rob

--
Robert Kaiser email: rkaiser AT sysgo DOT de
SYSGO RTS GmbH http://www.elinos.com
Klein-Winternheim / Germany http://www.sysgo.de

Tim Roberts

unread,
Sep 25, 2002, 2:25:40 AM9/25/02
to
mont...@yahoo.it (Fungolino) wrote:

>I am writing a very simple kernel module to switch the video output
>from CRT to TV and viceversa using an extended int 10h bios call.
>This bios call is specific to the industrial motherboard I am using.
>
>Whenever the module decides to switch the video output, it performs
>the bios call with the following code (gcc):
>
>__asm__ ("
> movw $0x5F22, %ax
> xor %bx, %bx
> int $0x10
>");
>
>The module loads and unload fine, but whenever the previous code is
>executed, I get a floating point exception error.
>The floating point exception error is caused by the int $0x10 call

Right. BIOS code is all 16-bit code. You have to switch to V86 mode to do
it.

There is a syscall from user mode to do this switch. I really have no clue
if it can be called through some back door in kernel mode. Go check out
the Linux Real Mode Interface at http://sourceforge.net/projects/lrmi.
--
- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Kasper Dupont

unread,
Sep 27, 2002, 11:06:25 AM9/27/02
to
Robert Kaiser wrote:
>
> However, I have seen some code before that does just what you want
> (switch video modes by making BIOS calls). I can't remember exactly
> how it worked (maybe it used virtual x86 mode). I forgot the URL
> though (sorry), but maybe someone else has it.

Here is an example that works on my computer. But I
have not yet seen any other computer where it works:

http://www.daimi.au.dk/~kasperd/vgareset.c

--
Kasper Dupont -- der bruger for meget tid på usenet.
For sending spam use mailto:aaa...@daimi.au.dk
or mailto:mcxumhv...@skrammel.yaboo.dk

0 new messages