Force text mode when GRUB reports RGB but display is text mode
On UTM/Mac, GRUB may report a RGB framebuffer while the actual display is in VGA text mode (0xB8000). The early VGA canary confirms text mode works. Override fb_info to EGA_TEXT before init_drivers() so vga_init() uses the correct text buffer instead of writing to an invisible pixel framebuffer. Also add EARLY_PRINT markers for SYSCALL, KBD, PROC, DRV stages.
This commit is contained in:
18
src/kernel.c
18
src/kernel.c
@@ -252,15 +252,33 @@ void kernel_main(uint32_t magic, uint32_t addr) {
|
|||||||
offset_print("TSS initialized\n");
|
offset_print("TSS initialized\n");
|
||||||
|
|
||||||
init_syscalls();
|
init_syscalls();
|
||||||
|
EARLY_PRINT("SYSCALL ");
|
||||||
offset_print("Syscalls initialized\n");
|
offset_print("Syscalls initialized\n");
|
||||||
|
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
|
EARLY_PRINT("KBD ");
|
||||||
offset_print("Keyboard initialized\n");
|
offset_print("Keyboard initialized\n");
|
||||||
|
|
||||||
init_process();
|
init_process();
|
||||||
|
EARLY_PRINT("PROC ");
|
||||||
offset_print("Process subsystem initialized\n");
|
offset_print("Process subsystem initialized\n");
|
||||||
|
|
||||||
|
/* If the early VGA canary at 0xB8000 was visible, the display is
|
||||||
|
* definitely in text mode, regardless of what the GRUB framebuffer
|
||||||
|
* tag says. Force text mode so vga_init doesn't try to use a
|
||||||
|
* pixel framebuffer that isn't actually being displayed. */
|
||||||
|
if (fb_info.type == FB_TYPE_RGB) {
|
||||||
|
offset_print(" Overriding fb type from RGB to EGA_TEXT (early VGA visible)\n");
|
||||||
|
fb_info.type = FB_TYPE_EGA_TEXT;
|
||||||
|
fb_info.addr = 0x000B8000;
|
||||||
|
fb_info.width = 80;
|
||||||
|
fb_info.height = 25;
|
||||||
|
fb_info.bpp = 16;
|
||||||
|
fb_info.pitch = 80 * 2;
|
||||||
|
}
|
||||||
|
|
||||||
init_drivers();
|
init_drivers();
|
||||||
|
EARLY_PRINT("DRV ");
|
||||||
offset_print("Drivers initialized\n");
|
offset_print("Drivers initialized\n");
|
||||||
|
|
||||||
/* At this point the VGA driver has been initialized and taken over
|
/* At this point the VGA driver has been initialized and taken over
|
||||||
|
|||||||
Reference in New Issue
Block a user