GRUB2 Real Mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
inixsoftware
Member
Member
Posts: 32
Joined: Fri Jan 31, 2014 8:21 am

GRUB2 Real Mode

Post 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.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: GRUB2 Real Mode

Post 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.
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
Post Reply