Disk access in protected mode...
Posted: Fri Oct 22, 2004 8:33 pm
Hey everyone,
We are currently trying to write a monotasking 32-bit os and our basic code outline is: (* = not done/working yet)
Real-mode bootloader:
- reads self and an arbitrary length of attatched code that in essence just runs longer than the 512 byte bootsector.
- in the non-bs real-mode code it initalizes an idt, and gdt and switches to protected mode, in which it has a flat non-address translated memory model.
Protected-mode code:
-Implements a subset of the linux int0x80 system calls*
-Loads a statically linked elf file from disk to a base adress based on its header*
-and jumps to its entry point*
Basically we get into protected mode fine, and our user interrupts work without problems, but we cant access disks.
Obviously we are aware that the bios interrupts dont work in protected mode, so we tried implementing ide drive access code by using port io. (similar to http://www.nondot.org/sabre/os/files/Disk/HD_PORTS.asm)
Basically it doesn't work at all, and we've been trying to debug for a long time now. We're stumped.
After searching of the internet, it seems that any resources available regarding 32-bit direct disk access in protected mode are nonexistent... can anyone tell us if it's possible to access the hard disk without switching to real mode and calling the BIOS interrupts? Or, alternatively, another way of accomplishing our goal?
Thanks guys.
-Alex, Lucas.
We are currently trying to write a monotasking 32-bit os and our basic code outline is: (* = not done/working yet)
Real-mode bootloader:
- reads self and an arbitrary length of attatched code that in essence just runs longer than the 512 byte bootsector.
- in the non-bs real-mode code it initalizes an idt, and gdt and switches to protected mode, in which it has a flat non-address translated memory model.
Protected-mode code:
-Implements a subset of the linux int0x80 system calls*
-Loads a statically linked elf file from disk to a base adress based on its header*
-and jumps to its entry point*
Basically we get into protected mode fine, and our user interrupts work without problems, but we cant access disks.
Obviously we are aware that the bios interrupts dont work in protected mode, so we tried implementing ide drive access code by using port io. (similar to http://www.nondot.org/sabre/os/files/Disk/HD_PORTS.asm)
Basically it doesn't work at all, and we've been trying to debug for a long time now. We're stumped.
After searching of the internet, it seems that any resources available regarding 32-bit direct disk access in protected mode are nonexistent... can anyone tell us if it's possible to access the hard disk without switching to real mode and calling the BIOS interrupts? Or, alternatively, another way of accomplishing our goal?
Thanks guys.
-Alex, Lucas.