Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 11:40 am



Post new topic Reply to topic  [ 4 posts ] 
 how to know if i'm in proteced or in real mode 
Author Message

Joined: Mon Feb 08, 2010 12:20 pm
Posts: 12
Post how to know if i'm in proteced or in real mode
I wanted to ask how to know (with what kind of code) if right now my bootloader has loaded in real mode or protected mode? For example, I want to print out A, if I'm already in proteced mode. Can anyone give me a code example or maybe theres another method with whom I can get the desired effect.


Sat Mar 06, 2010 8:34 am
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post Re: how to know if i'm in proteced or in real mode
I wont give code, but using ASM or C, you can check for the relevant 1 Bit flag in CR0.

_________________
Thank you for reading,

Kieran C G Foot


Sat Mar 06, 2010 10:02 am
Profile WWW

Joined: Thu Jan 07, 2010 4:46 am
Posts: 5
Post Re: how to know if i'm in proteced or in real mode
But you must make sure that the code is the same both in 16 and 32 bit mode. ;)


Sun Mar 07, 2010 4:23 pm
Profile

Joined: Wed Feb 10, 2010 6:32 am
Posts: 26
Post Re: how to know if i'm in proteced or in real mode
isn't it simply

cr0 % 2 == 0 => real mode else protected mode?

or am I wrong here? :D


Sat Mar 13, 2010 6:56 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 14 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.