I learn that when computer starts it is in real mode.
And kernel is responsible for switching mode from real to protected.
Ok , my question is Grub boot loader runs in real mode or in protected mode ?
-
Is there an answer here: http://stackoverflow.com/questions/97946/grub-and-getting-into-real-mode-low-level-assembler-question? Including the link in the answer I mean. – AzP Feb 06 '12 at 10:45
-
No I gone through it already ... I don't get exact answer ! – Vikram Feb 06 '12 at 10:47
-
Perhaps the same here: http://stackoverflow.com/questions/4821911/does-grub-switch-to-protected-mode – AzP Feb 06 '12 at 10:48
-
I would assume (makes an ass out of u and me, hehe) that the bootloader runs in Real mode since the kernel is actually responsible to switch from it to protected mode. – AzP Feb 06 '12 at 10:49
-
http://oss.sgi.com/LDP/HOWTO/Kernel-HOWTO/linux_boot_process.html and here http://www.gnu.org/software/grub/manual/grub.html#GNU_002fLinux they mention running in Real mode ("which involves loading another boot loader and jumping to it in real mode") before booting to protected mode. – AzP Feb 06 '12 at 10:50
2 Answers
AFAIK, Grub starts in real mode like any other software loaded at boot. It switches to protected mode for its run time (detecting HD, displaying menus etc.) and switches back into real mode before loading and running OS such as Linux that do not support multiboot protocol.

- 14,900
- 40
- 57
See http://duartes.org/gustavo/blog/post/kernel-boot-process for a detailed answer, but basically Grub does not switch to protected mode when running Linux. It loads the real-mode part of the kernel in low memory and let it do the switch itself (as required per the Linux Boot Protocol, http://lxr.linux.no/#linux+v2.6.25.6/Documentation/i386/boot.txt)
However, Grub also supports the Multiboot Specification, which starts the loaded OS in protected mode. This is done for non-Linux kernels, like modern homebrew OSes for which the makers do not want to bother with the hassle of switching to protected mode.

- 7,923
- 3
- 22
- 32