2004-09-06 15:27:33

by Jozef Vesely

[permalink] [raw]
Subject: Re: x86 - Realmode BIOS and Code calling module



On Thu, 12 Aug 2004, Alan Cox wrote:

> On Iau, 2004-08-12 at 10:36, Jakub Vana wrote:
> > Hello,
> >
> > I have written Linux Kernel module that allows you to call BIOS
> > interupts, Far services or your own code.
>
> Why is this better than LRMI in user mode. To do BIOS calls safely
> you need to be very careful about things like PCI locking, I/O
> emulation and the ROM scribbling in strange places. LRMI can handle this
> in user space as does x86emu in Xorg.
>

In-kernel BIOS calls are useful:
I (and many others) have experienced problems with resuming from ACPI S3
state. Some graphic cards need to have their state saved before suspend
and restored after resume, otherwise the screen stays blank. VESA BIOS
call 0x4f04, does exactly that.

Yes it can be done from userspace, but at the time devices are woken up,
userspace processes are still sleeping. And if something goes wrong with
device wakeup (not uncommon thing with ACPI :-) ), you end up with a
backtrace on a blank screen :-(. (Modern laptops do not have serial port
to hook up terminal to.)

to Jakub:
You promised to put that code somewhere on the net, could
you please send me an URL.

Thank you


Jozef Vesely
[email protected]



2004-09-06 18:05:38

by Alan

[permalink] [raw]
Subject: Re: x86 - Realmode BIOS and Code calling module

On Llu, 2004-09-06 at 16:27, Jozef Vesely wrote:
> In-kernel BIOS calls are useful:
> I (and many others) have experienced problems with resuming from ACPI S3
> state. Some graphic cards need to have their state saved before suspend
> and restored after resume, otherwise the screen stays blank. VESA BIOS
> call 0x4f04, does exactly that.

As I understand it VESA 0x4F04 is for saving/restoring mode state, not
restoring the video card from poweroff. Correct me if I'm wrong here.

Secondly if you wanted to do this cleanly you could still do the save
from vm86 in user space and the restore on the 16bit return path having
checked a save was made and that the video bios hasn't gone for a walk.