| 1234567891011121314151617181920212223 |
- If you have been read boot.asm, you must know it reads loader from disk and jump to it.
- But, how can we read disk without a standard IDE driver?
- You can know how computers startup after you read 'How XNIX and other operating systems startup': CPU will execute BIOS in ROM. And BIOS will initialize all devices it can find. Then BIOS jump to our MBR (boot.asm in XNIX).
- But BIOS did another work before it jumps to MBR: initial Onterrupt Vectors Table (IVT, Interrupt Descriptor Table in protect-mode). Word 'interrupts' in OS world often means 'traps'.
- When your program makes a mistake (for example, divide by zero), CPU will raise a trap (or interrupt). Then OS should do something (kill your program). The OS uses a function to 'do something', it should regist in IDT.
- And almost devices will raise an interrupt when it finished its work. The OSes will accept it (like clock, mouse, keyboard etc. )
- So IDT uses to save trap handler's address (in fact, it saves other things in protect-mode or long-mode). CPU will read from IDT when a trap was raised. And call trap handler if it's avaliable.
- We know we should use a driver to read / write anything (but without registers and memory). BIOS did it for us. So it's really Basic Input & Output System. Now many BIOSes (EFI BIOS) support network stack! We can use network in BIOS.
- But you should know a good OS can't use BIOS all the time because it's not cool (but DOS used all the time :-)). You should implement by yourself.
- Okay, it's time to write codes. Goodbye!
- ASK ME AT BLOG.CSDN.NET (https://blog.csdn.net/utf80/)!
- driver: a program uses to read/write your devices (like your disk)
|