Brendan's BIOS Wrapper (experimental!)
Posted: Thu Mar 28, 2013 8:34 pm
Hi,
This code allows software to use the BIOS from protected mode.
WARNING: This is just an experimental prototype hack, and wasn't written as 100% bullet-proof code.
It switches to protected mode and installs its own IDT. When any interrupt occurs in protected mode, it switches back to real mode and executes the relevant BIOS interrupt handler, then switches back to protected mode and returns to protected mode.
I also made it so that it knows the difference between an exception and a software interrupt or IRQ. If an exception occurs it just locks up instead of executing the BIOS's interrupt handler (I was going to add some "blue screen of death" crash dump code to it but I was lazy).
There's also some extremely bad floppy disk boot code that I slapped together for testing. You'd want to use NASM to assemble it (but YASM would probably work too).
Source code is in the attachment. The copyright is "public domain" - do whatever you want with it.
Cheers,
Brendan
This code allows software to use the BIOS from protected mode.
WARNING: This is just an experimental prototype hack, and wasn't written as 100% bullet-proof code.
It switches to protected mode and installs its own IDT. When any interrupt occurs in protected mode, it switches back to real mode and executes the relevant BIOS interrupt handler, then switches back to protected mode and returns to protected mode.
I also made it so that it knows the difference between an exception and a software interrupt or IRQ. If an exception occurs it just locks up instead of executing the BIOS's interrupt handler (I was going to add some "blue screen of death" crash dump code to it but I was lazy).
There's also some extremely bad floppy disk boot code that I slapped together for testing. You'd want to use NASM to assemble it (but YASM would probably work too).
Source code is in the attachment. The copyright is "public domain" - do whatever you want with it.
Cheers,
Brendan