What is the best place to enter protected mode?
Posted: Sat Mar 29, 2014 4:27 am
What is the best place to enter protected mode? (bootloader stage 1, stage 2 or kernel or something else?)
The Place to Start for Operating System Developers
https://f.osdev.org/
What is protected mode for? Do your loader stages need protection from apps? Do they need to access memory above the 1MB point? If not, stay in real mode while you're still working with the BIOS to load your code, to set up a better screen mode and to get a map of usable memory. If you need to load in lots of code above the 1MB point, write code to go in and out of protected mode so that you can use the BIOS to load it to a buffer in low memory and then switch in and out of protected mode to shift it up memory. Once you've finished using the BIOS you can stay in protected mode, though you will need to limit how far you change the set-up of the machine if you want to change back into real mode to use the BIOS again to save or load more data later on, because every time you switch to real mode you'll need to undo all those changes.Roman wrote:What is the best place to enter protected mode? (bootloader stage 1, stage 2 or kernel or something else?)