Page 1 of 1
Switching from protected mode to real mode and back
Posted: Thu Mar 08, 2012 11:24 am
by bluman
Hello,
Sorry for the stupid question, but I can't figure it out how to switch from protected mode to real mode and then get back to protected mode and continue running. Is there any easy way to do it? I need to do this in order to be able to switch to VGA 0x13 mode.
Thanks,
Paul Herman
Re: Switching from protected mode to real mode and back
Posted: Thu Mar 08, 2012 11:34 am
by bluemoon
While getting the processor from pmode to real mode and back to pmode is as easy as flipping a bit in CR0. However before doing so you need to clean up and setup all the surrounding environments like paging, IRQs, etc. As Brendan said on
this thread, you need to "stop the world" to call real mode BIOS, which usually end up a mess.
It's probably easier to deal with the VGA directly.
Check this out
VGA_Hardware.
Re: Switching from protected mode to real mode and back
Posted: Thu Mar 08, 2012 12:03 pm
by gerryg400
This wiki page tells you how to do it.
http://wiki.osdev.org/Real_mode
Re: Switching from protected mode to real mode and back
Posted: Thu Mar 08, 2012 3:58 pm
by Combuster
Bluemoon +1, mostly because of the following:
I need to do this in order to be able to switch to VGA 0x13 mode.
You definitely don't. I recommend that you check out the link posted as well as the
FAQ entry on changing video modes and then decide if you really need it or if you are just misinformed.