From 8316265048a465dbffe166a0abebea5cf11e9c9c Mon Sep 17 00:00:00 2001 From: Adam Eehan Date: Sat, 24 Oct 2026 16:09:51 +0530 Subject: [PATCH] fix(uefi): zero only 8KB page tables, reload 64-bit lgdt, glowing cyan splash & keep gfxpayload --- arch/x86_64/boot.s | 11 ++++++----- drivers/vbe.c | 9 +++++++-- scripts/build_iso.sh | 27 ++++++++++++++------------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/x86_64/boot.s b/arch/x86_64/boot.s index c3f3cb6..d1b548c 100644 --- a/arch/x86_64/boot.s +++ b/arch/x86_64/boot.s @@ -72,11 +72,9 @@ _start: movl %eax, %ebp movl %ebx, %esi - /* Zero out the entire .bss section (clears page tables, stacks, global state) */ - movl $_bss_start, %edi - movl $_bss_end, %ecx - subl %edi, %ecx - shrl $2, %ecx /* Number of 4-byte dwords */ + /* Zero out ONLY the PML4 and PDPT page tables (8KB = 2048 dwords) */ + movl $pml4_table, %edi + movl $2048, %ecx xorl %eax, %eax rep stosl @@ -182,6 +180,9 @@ halt_loop: .global long_mode_entry .type long_mode_entry, @function long_mode_entry: + /* Reload GDT in 64-bit mode to guarantee 64-bit canonical GDTR base */ + lgdt (gdt64_pointer) + /* Reload data segment registers */ movw $0x10, %ax movw %ax, %ds diff --git a/drivers/vbe.c b/drivers/vbe.c index 324c817..6fca350 100644 --- a/drivers/vbe.c +++ b/drivers/vbe.c @@ -48,12 +48,17 @@ void vbe_allocate_backbuffer(void) { void vbe_early_boot_splash(void) { if (!s_screen.initialized || !s_screen.front_buffer) return; - /* Fill screen with deep obsidian */ + /* Fill screen with vibrant deep cyber navy & bright glowing cyan border */ for (uint32_t y = 0; y < s_screen.height; y++) { uint8_t* row = ((uint8_t*)s_screen.front_buffer) + (y * s_screen.pitch); uint32_t* pixels = (uint32_t*)row; + bool is_border_y = (y < 8 || y >= s_screen.height - 8); for (uint32_t x = 0; x < s_screen.width; x++) { - pixels[x] = COLOR_OBSIDIAN; + if (is_border_y || x < 8 || x >= s_screen.width - 8) { + pixels[x] = COLOR_CYAN_GLOW; + } else { + pixels[x] = 0xFF0B1426; + } } } diff --git a/scripts/build_iso.sh b/scripts/build_iso.sh index 7c979ac..fa2ca71 100755 --- a/scripts/build_iso.sh +++ b/scripts/build_iso.sh @@ -27,22 +27,15 @@ insmod efi_uga insmod font set gfxmode=1920x1080x32,1024x768x32,auto -set gfxpayload=1920x1080x32,1024x768x32,auto +set gfxpayload=keep set timeout=5 set default=0 -menuentry "Airlys Sovereign OS (Acer Nitro Bare Metal & UEFI GOP)" { +menuentry "Airlys Sovereign OS (Acer Nitro Bare Metal - Keep Active GOP)" { insmod all_video insmod efi_gop - set gfxpayload=1920x1080x32,1024x768x32,auto - multiboot2 /boot/airlys.elf - boot -} - -menuentry "Airlys Sovereign OS (1024x768 TrueColor Framebuffer)" { - insmod all_video - set gfxpayload=1024x768x32,auto + set gfxpayload=keep multiboot2 /boot/airlys.elf boot } @@ -50,15 +43,23 @@ menuentry "Airlys Sovereign OS (1024x768 TrueColor Framebuffer)" { menuentry "Airlys Sovereign OS (1920x1080 Native FHD Framebuffer)" { insmod all_video insmod efi_gop - set gfxpayload=1920x1080x32,auto + set gfxpayload=1920x1080x32,keep,auto multiboot2 /boot/airlys.elf boot } -menuentry "Airlys Sovereign OS (Fallback Multiboot 1)" { +menuentry "Airlys Sovereign OS (1024x768 TrueColor Framebuffer)" { + insmod all_video + insmod efi_gop + set gfxpayload=1024x768x32,keep,auto + multiboot2 /boot/airlys.elf + boot +} + +menuentry "Airlys Sovereign OS (Fallback Auto Mode)" { insmod all_video set gfxpayload=auto - multiboot /boot/airlys.elf + multiboot2 /boot/airlys.elf boot } EOF