Accessing disk in Protected Mode
Accessing disk in Protected Mode
I've read some bootloader code from brokenthorn that has FAT12 driver. The problem that it's calling BIOS interrupt (0x10?) while I'm already in pmode due to usage of GRUB as my bootloader. How can I implement in in pmode?
Re: Accessing disk in Protected Mode
Hi,
If you want the int 0x10 functions, you have two options - switch back to real mode or run a v86 task. See the GRUB page on the wiki, which has a link at the bottom to a thread about switching back to real mode.
You can also create a protected mode wrapper function for BIOS calls, which automatically switches back to real mode, executes a function, and returns to PMode. This may be worth doing if you plan on running a lot of real mode code (for disk IO, for example).
Cheers,
Adam
If you want the int 0x10 functions, you have two options - switch back to real mode or run a v86 task. See the GRUB page on the wiki, which has a link at the bottom to a thread about switching back to real mode.
You can also create a protected mode wrapper function for BIOS calls, which automatically switches back to real mode, executes a function, and returns to PMode. This may be worth doing if you plan on running a lot of real mode code (for disk IO, for example).
Cheers,
Adam
-
- Member
- Posts: 153
- Joined: Sun Jan 07, 2007 9:40 am
- Contact:
Re: Accessing disk in Protected Mode
Another route is to write a pmode driver that accesses the floppy directly without using BIOS. It will likely be much faster than real mode or a v86 task.AJ wrote:If you want the int 0x10 functions, you have two options
Re: Accessing disk in Protected Mode
leledumbo wrote:The problem that it's calling BIOS interrupt (0x10?)
Agreed for disk access. Int 0x10 is, however, for video services which may only be accessible via the BIOS unless you write a specific driver for each individual video card. Alternatively rely on the fact that the VESA PMode interface is present, which is a bit of a dodgy assumption.tantrikwizard wrote:Another route is to write a pmode driver that accesses the floppy directly without using BIOS.AJ wrote:If you want the int 0x10 functions, you have two options
Cheers,
Adam
Re: Accessing disk in Protected Mode
Hre is a demo i wrote, of a pmode floppy driver http://dex4u.com/demos/FddDemo.zip
Note: the bios driver only read/writes one sector, each time it goes to and from realmode, this shows how fast it is to goto and from realmode to pmode.
In my OS, i have both a bios (as in go back to realmode) and a pmode floppy driver, and there is no differance in read/write speed between the two drivers, and its not because the pmode driver is not written well, because its faster to load a whole disk by going back and forth to realmode, than load the same disk from with in XP or linux.tantrikwizard wrote:Another route is to write a pmode driver that accesses the floppy directly without using BIOS. It will likely be much faster than real mode or a v86 task.AJ wrote:If you want the int 0x10 functions, you have two options
Note: the bios driver only read/writes one sector, each time it goes to and from realmode, this shows how fast it is to goto and from realmode to pmode.
-
- Member
- Posts: 153
- Joined: Sun Jan 07, 2007 9:40 am
- Contact:
Re: Accessing disk in Protected Mode
Right, there will be no difference between the read/write speed of the drive. Those are set by the hardware's limitation. The slight performance increase will be from the reduced overhead of switching in and out of different execution modes.Dex wrote:...and there is no differance in read/write speed between the two drivers...
Re: Accessing disk in Protected Mode
Interesting - is this test performed on a purely PIO protected mode driver or one that utilises full burst-DMA too?
Re: Accessing disk in Protected Mode
Full burst-DMAJamesM wrote:Interesting - is this test performed on a purely PIO protected mode driver or one that utilises full burst-DMA too?
From my tests, the problem seem to be controller timing, if you implement the times as per the floppy controller spec, for things like floppy get to full speed delay etc, your driver will be slower than the bios driver, if you try and use smaller delays than the spec, than the code does not work.
Why this is i do not know.
If you want to test it you can download DexOS, than from the CLI if you can type:
pmode <enter>
You will be using the pmode floppy driver, if you try to run a program from floppy, if you type:
bios <enter>
You will be using the bios, as in going to and from realmode for each sector loaded.