I heard that we cann't use BIOS in Pmode (Why ?) and if thats true then how can we access hardware (Like say Floppy drives). Or do we have to use some sort of memory mapping (like 0x0B800000 for vid-mem)
Thanks
Accessing BIOS Interrupts in Pmode?
RE:Accessing BIOS Interrupts in Pmode?
There's nothing stopping us from using the BIOS in pmode. All we have to do is write a vm86 monitor and reflect all hardware interrupts and BIOS functions down to vm86 mode. Then we have to deal with pointer translation, and all that junk. And then we can't actually do anything while the BIOS code is reading from the floppy, because the BIOS uses blocking I/O.
It just happens to be -easier- to write our own drivers. A text-mode VGA driver, for example, just needs to know how the video memory is laid out, where the video memory is, and how to set the hardware cursor position through I/O ports. A keyboard driver is a little trickier but still only a couple K of code.
My floppy driver is currently about 3 K for the device handling, and another 3 K for some of the higher level abstractions.
A basic IDE hard disk driver fits in 3 K of source easily (mine is exceptionally primitive, and fits in 1 K).
After you have video, keyboard, floppy, and hard disk drivers, you basically have everything that the BIOS provides for you. And your versions will be more suited to what you want to do with them than the BIOS versions would be.
It just happens to be -easier- to write our own drivers. A text-mode VGA driver, for example, just needs to know how the video memory is laid out, where the video memory is, and how to set the hardware cursor position through I/O ports. A keyboard driver is a little trickier but still only a couple K of code.
My floppy driver is currently about 3 K for the device handling, and another 3 K for some of the higher level abstractions.
A basic IDE hard disk driver fits in 3 K of source easily (mine is exceptionally primitive, and fits in 1 K).
After you have video, keyboard, floppy, and hard disk drivers, you basically have everything that the BIOS provides for you. And your versions will be more suited to what you want to do with them than the BIOS versions would be.
RE:Accessing BIOS Interrupts in Pmode?
I do, for about 512 bytes. Although I have been thinking about rewriting my bootsector to have it's own floppy driver, which would obviate even that much dependance.
RE:Accessing BIOS Interrupts in Pmode?
Well I don't know vm86 (especially the pointer copying ??? ) . Please help me.
RE:Accessing BIOS Interrupts in Pmode?
IIRC, BIOS is written in 16bit, and you're running in 32bit mode. BIOS call are too slow, write your own device driver so you don't need to pass from/to 16/32 bit each time and you don't have BIOS limitations like the 1024 cylinder limit.
RE:Accessing BIOS Interrupts in Pmode?
Umm... No.
I've written a vm86-mode system once. It wasn't pretty. And picking up the pieces of my FAT tables after I completely screwed up the handling for the OUTSW instruction didn't help.
It's complex enough that you'd be better off writing your own drivers for the basic stuff. The BIOS drivers are lame enough that you'd be better off writing your own drivers for the basic stuff.
About the only thing that you should consider needing vm86 mode for is VESA mode switching. And many people try to find ways around doing that, too.
In short, "Don't go there, that's where the monster is hiding!"
--Jamethiel
I've written a vm86-mode system once. It wasn't pretty. And picking up the pieces of my FAT tables after I completely screwed up the handling for the OUTSW instruction didn't help.
It's complex enough that you'd be better off writing your own drivers for the basic stuff. The BIOS drivers are lame enough that you'd be better off writing your own drivers for the basic stuff.
About the only thing that you should consider needing vm86 mode for is VESA mode switching. And many people try to find ways around doing that, too.
In short, "Don't go there, that's where the monster is hiding!"
--Jamethiel
RE:Accessing BIOS Interrupts in Pmode?
Floppy I/O is the hardest part, in my opinion. A simple text writer is really easy to make, all you need is a functions that STOSes a string in 0xb8000. A keyboard ISR is quite easy too, just a few in/outs, look up some docs (then just have a function that reads from the keyboard buffer). What else do you need? Video, VESA works in pmode.