Page 1 of 1

GRUB2 Real Mode

Posted: Tue Apr 29, 2014 3:50 pm
by inixsoftware
Currently, I am using GRUB2 as my bootloader. Can GRUB2 boot the kernel and stay in Real Mode (not making the switch to Protected Mode)? Is this possible?

The reason I am asking is that I want to do some things in Real mode and then stay in Protected Mode, so I don't have to switch back and forth.

Re: GRUB2 Real Mode

Posted: Tue Apr 29, 2014 5:49 pm
by Bender
Don't do stuff in Real Mode do it in an emulator or v8086 mode. :)
As for mode switching (Real-»Protected/Protected-»Real) has been asked a lot of times, IIRC the steps are:
1. Restore all hardware configuration to crap BIOS state. (Remap PICs; Mess with floppy controller etc.)
2. Switch to 16-bit Segments.
3. Disable CR0.PE
4. Far Jump to 16-bit Code Segment
5. You're in Real Mode; Load the BIOS IDT
6. ????
7. ???? (Fault? Profit?)
8. Switch back.
Your drivers will be seriously bugged by this; They'll miss IRQs while the switch. Switching to Real Mode sounds awful unless you want to shutdown the system using the APM Interface.