How do we shift from protected mode to real mode in Linux 2.6?
-
7Why? Your Linux install not crashing enough for ya' ? – paxdiablo May 06 '09 at 13:02
-
1What exactly are you trying to achieve? What you're asking isn't really possible, but if you give a bit more context, someone might be able to show you another way to achieve what you need. – jalf May 06 '09 at 17:00
5 Answers
You do not.
The kernel cannot function at all in real mode, nor can bios calls be (sensibly) made, so you wouldn't be able to do anything anyway.
You might look at how DosEMU uses v86 mode to run your "real mode" code, but that's all.

- 62,604
- 14
- 116
- 151
-
Are you sure it's technically possible? I seem to remember (from way back) that i386 had no way to switch back to real mode after entering protected mode but I may be mistaken. – R.. GitHub STOP HELPING ICE Jan 31 '11 at 08:15
-
1It is technically possible, and most BIOSes and boot loaders have to do it. You just set up segments in the GDT resembling real mode and then turn off the protected mode bit. The problem is that you can't do that in user mode and the kernel would be useless, so you probably want v86. – rpjohnst May 03 '11 at 23:53
You could also take a look at FreeDOS if you really need real mode on the hardware.

- 3,200
- 4
- 25
- 38
The kernel switches from real mode to protected mode during the very beginning of the boot/start sequence and there is no turning back. See How Boot Loaders Work for more detailed information.
If you have some program that needs real mode, there is v86 mode. Some work is ongoing to add support for this in 64 bit mode.

- 26,565
- 10
- 94
- 165
We can switch from protected mode to real mode, by writing some lines of code as the part of kernel.
The main thing is after disabled the PE bit on cr0 register, we need to to load the appropriate GDT, LDT, IDT. Just follow this link for more details http://www.sudleyplace.com/pmtorm.html.

- 4,056
- 2
- 22
- 24
-
Thanks for the link. But is there a simple set of instructions to switch from protected mode to real mode, load the first 512 bytes of /dev/sda to 0000:0700 and JMP to that address? – WinEunuuchs2Unix Oct 06 '16 at 01:22