title: How to read/write a hard disk when CPU is in Protected Mode?
body: <p>I am doing an OS experiment. Until now, all my code utilized the real mode BIOS interrupts to manipulate the hard disk and floppy. But once my code enables Protected Mode, all the real mode BIOS interrupt service routines won't be available.</p>
  
  <p>I have a feeling that I need to do some hardware drivers now. Am I right? Is this why an OS is so difficult to develop?</p>
  
  <p>I know that hardware is controlled by reading from and writing to certain control or data registers. For example, I know that the "Command Block Registers" of a hard disk range from <code>0x1F0</code> to <code>0x1F7</code>. I am wondering whether the register addresses of so many different hardware devices are consistent on different platforms? Or do I have to detect that before using them? How would I do that?</p>
  
  <p>Since I am not sure about how to read/write a floppy or a hard disk in Protected Mode, I have to use BIOS interrupts to load all my necessary kernel files from the floppy before entering protected mode. What could I do if my kernel file exceeds the real mode 1M space limit?</p>
  
  <p>How do I read/write a hard disk when the CPU is in Protected Mode?</p>