OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 1:09 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: What is the best place to enter protected mode?
PostPosted: Sat Mar 29, 2014 4:27 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
What is the best place to enter protected mode? (bootloader stage 1, stage 2 or kernel or something else?)

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: What is the best place to enter protected mode?
PostPosted: Sat Mar 29, 2014 2:04 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1150
Location: Scotland
Roman wrote:
What is the best place to enter protected mode? (bootloader stage 1, stage 2 or kernel or something else?)

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.

Whatever you do, don't return to your original plan of writing a real-mode OS: protected mode will enable you to access a linear frame buffer for high-resolution graphics modes and make your OS a lot more capable than a real-mode OS as a result, as well as giving you gigabytes of memory to play with.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: What is the best place to enter protected mode?
PostPosted: Wed Apr 02, 2014 2:13 am 
Offline
Member
Member
User avatar

Joined: Thu Dec 19, 2013 1:40 am
Posts: 100
Location: Asia, Singapore
My view on this is you load protected mode once you are done with things you want to do in real mode (things that can only be done in real mode, if there is, or things you prefer done in real mode due to the BIOS functions available to you etc.) I don't suggest switching between Real mode and Protected mode unless there is a must.

_________________
CookieOS. Want a cookie? Its only black and white for now though, probably as bad as my baking skills.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 88 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group