How to interact with disks or cd-roms in Protected Mode?
I am trying to write a hobby experiment OS now. And I am having this problem.
In Real Mode, I can rely on BIOS to deal with disks and cd-roms (sometimes LBA BIOS extenstion is used). But once I enter the Protected Mode, I cannot use BIOS interrupt any more. So, should开发者_如何学JAVA I write my own device driver? Is there any best practice?
Thanks!
There are several approaches:
- virtualize the BIOS interface in protected mode
- write your own protected mode driver
- don't support the drives
Granted, the last one isn't great for general-purpose systems, but it has its uses, like in the military product I am currently working on—they don't want removable media for security reasons.
Writing your own driver has several advantages:
- The BIOS interface is a "busy wait" implementation. Every BIOS disk access will stall all processes in your O/S.
- Also, drive i/o is one of several abstraction layers, many of which are much more complex to realize a filesystem.
- You need not start from scratch. Begin with the Linux disk drivers. See this.
精彩评论