octacone wrote:
I guess I could enter VBE mode before I switch to protected mode. Does that mean that the mode I set is the mode I have to use?
Virtual 8086 is one of the options, but that requires stuff I currently don't have implemented.
Other way is to get back to 16 bit mode, but what about my kernel that was running in protected mode, where does that code go. Like if I have running apps, how would they perform in 16bit mode??? Then I would have to go back to protected mode, enabled paging and GDT again right??
It'd be nice if moderators split this into a VBE discussion thread.
Anyway, v8086 is indeed one of the options, but it won't work on most current hardware because the BIOS goes to protected mode without informing you. This is to access MMIO registers in high memory (3-4 GB) to configure the graphics card.
Going back to 16-bit mode is an option, and calling the BIOS from there will work and then you return to protected mode. What do you mean where does your code go? It doesn't go anywhere; it stays in memory, just inaccessible to real mode because it's most likely above 1 MB. If you have running apps, you'd disable multitasking and paging before going back to real mode. Your scheduler will definitely save the application state before disabling multitasking. Then, when returning to protected mode, you'll restore all the system state. Nothing in the system will even be aware of the change that occurred.
So to make a long story short: v8086 is a better solution in theory, but in practice, using real mode is better for better hardware compatibility.
EDIT: If you want to use VBE 3.0 and don't know how it works, consider reading official specs. Reading documentation is much easier than it sounds, really, and you're going to need to know how to read them one way or another (for example, the Wiki lacks a lot of info on long mode, which I got from Intel's manuals, and it also lacks a lot of info on ACPI, which I also got from ACPI specs.)