OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 8:27 am

All times are UTC - 6 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 24 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 8:37 am 
Offline
Member
Member

Joined: Mon Jan 14, 2008 5:53 am
Posts: 188
Location: Helsinki
I took my time to read this thread. My interpretation is that you are saying, that you are saying, that when software switches CPU back to real mode, it must also restore the hardware configuration made by BIOS so it can use BIOS calls, which are the only sensible reason to switch back to real mode. You also say that cases where some other firmware than BIOS is used aren't related to this discussion. Where am I wrong? If it is interpretation of your term "default configuration", please tell why someone should restore the hw configuration left by EFI to things function correctly in real mode.

I guess I'll just go write a DOS clone for EFI based systems. Damn, I didn't remember I have to restore the hardware configuration left by BIOS when I switch to real mode. And, oh, right, this all doesn't make sense, because I can't make any BIOS calls, which would be the only sensible reason to switch back to real mode. I guess I have to forget that project.


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 9:30 am 
Offline
Member
Member
User avatar

Joined: Sat Jul 17, 2010 12:45 am
Posts: 487
You are right, of course. But one thing I'd like to ask is that how many OS over here are EFI-aware? Even if we have reasonable amount of OSes that support EFI-booting(without GRUB), can I have a look at one that makes flexible Protected mode -> Real mode transition (to satisfy myself)?

_________________
Programming is not about using a language to solve a problem, it's about using logic to find a solution !


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 2:05 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
The answer is no. The argument has already been given before:
- If you need to drop to real mode from a running protected mode OS your design is seriously flawed.
- If you need to drop to real mode as part of your bootstrap, there should be no state that needs restoring.

In the case of EFI, there is no state to restore at all. In the case of a legacy BIOS, anything you do to the hardware without the bios' knowledge has the ability to break it until a reset as you can in many cases not know what state the BIOS expects, so the only correct approach is to make all the BIOS calls before any direct hardware access after which the BIOS is not to be touched ever after.

So the entire point about restoring state is only about what hacks you might try to have some chance of success of implementing an "exit to DOS" option without rebooting.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 9:29 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2426
Location: Canada
Just going to chime in here, but, dropping to real mode is not worth the trouble.. you have virtual 8086 mode and lightweight software emulators like x86emu.

As for the Wiki reference, perhaps that section should be removed entirely.

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 10:17 pm 
Offline
Member
Member

Joined: Thu Mar 25, 2010 11:26 pm
Posts: 1801
Location: Melbourne, Australia
Dropping to real mode can be useful. For example you could launch your OS from DOS (where you could be running your development environment) then drop back to real mode to continue development. It saves a lot of rebooting time.

_________________
If a trainstation is where trains stop, what is a workstation ?


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 10:24 pm 
Offline
Member
Member

Joined: Tue Apr 13, 2010 8:00 pm
Posts: 285
gerryg400 wrote:
Dropping to real mode can be useful. For example you could launch your OS from DOS (where you could be running your development environment) then drop back to real mode to continue development. It saves a lot of rebooting time.

The involvement of DOS is anyway with any modern project is a critical failure by default.

That said, how is VBE not a good reason to drop back into RM? EDIT: Nevermind.


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 10:38 pm 
Offline
Member
Member

Joined: Thu Mar 25, 2010 11:26 pm
Posts: 1801
Location: Melbourne, Australia
Quote:
The involvement of DOS is anyway with any modern project is a critical failure by default.
I disagree. I have found MSDOS to be an acceptably good boot-loader.

_________________
If a trainstation is where trains stop, what is a workstation ?


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 10:39 pm 
Offline
Member
Member

Joined: Tue Apr 13, 2010 8:00 pm
Posts: 285
gerryg400 wrote:
Quote:
The involvement of DOS is anyway with any modern project is a critical failure by default.
I disagree. I have found MSDOS to be an acceptably good boot-loader.
We differ in philosophy. :)


Top
 Profile  
 
 Post subject: Re: Wiki: Real Mode article broken
PostPosted: Sun Apr 10, 2011 11:35 pm 
Offline
Member
Member
User avatar

Joined: Sat Jul 17, 2010 12:45 am
Posts: 487
Combuster wrote:
If you need to drop to real mode from a running protected mode OS your design is seriously flawed.
Maybe. But that's how I like to experiment with my OS. I did present the idea of "Restoring the hardware to original configuration" just to reckon the possible consequences of switching to Real Mode. I didn't realize that would gain me criticism as a solid feedback. Nor did I expect that someone would criticise my design.
Brynet-Inc wrote:
As for the Wiki reference, perhaps that section should be removed entirely
I don't agree. V86 has it's own place. Some emulators don't even support it. There's a reason to drop to Real Mode.
Combuster wrote:
In the case of EFI, there is no state to restore at all.
Like I asked before, "how many OSes over here are EFI-aware?"
fronty wrote:
You also say that cases where some other firmware than BIOS is used aren't related to this discussion. Where am I wrong?
You're wrong at that very point. EFI is not the theme of this discussion, so I've been avoiding this from the very beginning. EFI is a very different beast. I know it's the replacement to the legacy-BIOS but it isn't quite supported in every OS here. So, I see no reason to divert this topic to EFI.

Since EFI is becoming the more centralized issue over here, let me get this straight...
Wiki: Real Mode article wrote:
The program needs to go through the following steps:
Disable the interrupts:
Turn off maskable interrupts using CLI.
Disable NMI (optional).
Turn off paging:
Transfer control to a 1:1 page.
Ensure that the GDT and IDT are in a 1:1 page.
Clear the PG-flag in the zeroth control register.
Set the third control register to 0.
........
So, there's a step suggesting to disable paging, no? So what if an OS uses segmentation instead of paging? That step is skipped, right? I too am following similar route. I just want to add a step that suggests to restore the hardware configuration. In case someone is implementing EFI, this step could be skipped. What's wrong with that?
Combuster wrote:
So the entire point about restoring state is only about what hacks you might try to have some chance of success of implementing an "exit to DOS" option without rebooting.
Hacks?

I know it is easy to criticize people, but extremely difficult to think from the other side.

Since it seems as if some guys over here, are annoyed by this discussion, I hereby request a moderator to lock this thread. In the end, it won't really matter, so there's no reason to continue it.

_________________
Programming is not about using a language to solve a problem, it's about using logic to find a solution !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 24 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 97 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