From 284a012509ce982559a34703b0976551a169e626 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 9 Dec 2023 17:33:58 +0200 Subject: [PATCH] Kernel: Add framebuffer information to kernel image --- kernel/arch/x86_64/boot.S | 22 ++++++++++++++++++---- kernel/arch/x86_64/linker.ld | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/kernel/arch/x86_64/boot.S b/kernel/arch/x86_64/boot.S index f2dd6ad462..331cefab9a 100644 --- a/kernel/arch/x86_64/boot.S +++ b/kernel/arch/x86_64/boot.S @@ -2,6 +2,10 @@ .set PG_READ_WRITE, 1<<1 .set PG_PAGE_SIZE, 1<<7 +.set FB_WIDTH, 800 +.set FB_HEIGHT, 600 +.set FB_BPP, 32 + #define KERNEL_OFFSET 0xFFFFFFFF80000000 #define V2P(vaddr) ((vaddr) - KERNEL_OFFSET) @@ -9,8 +13,8 @@ # multiboot2 header .section .multiboot, "aw" -multiboot2_start: .align 8 +multiboot2_start: .long 0xE85250D6 .long 0 .long multiboot2_end - multiboot2_start @@ -21,9 +25,9 @@ multiboot2_start: .short 5 .short 0 .long 20 - .long 800 - .long 600 - .long 32 + .long FB_WIDTH + .long FB_HEIGHT + .long FB_BPP # legacy start .align 8 @@ -38,6 +42,16 @@ multiboot2_start: .long 8 multiboot2_end: +.section .bananboot, "aw" + .align 8 +bananboot_start: + .long 0xBABAB007 + .long -(0xBABAB007 + FB_WIDTH + FB_HEIGHT + FB_BPP) + .long FB_WIDTH + .long FB_HEIGHT + .long FB_BPP +bananboot_end: + .section .bss, "aw", @nobits # Create stack .global g_boot_stack_bottom diff --git a/kernel/arch/x86_64/linker.ld b/kernel/arch/x86_64/linker.ld index 14dbf38946..e8c3d9d02b 100644 --- a/kernel/arch/x86_64/linker.ld +++ b/kernel/arch/x86_64/linker.ld @@ -11,6 +11,7 @@ SECTIONS { g_kernel_execute_start = .; *(.multiboot) + *(.bananboot) *(.text.*) } .userspace ALIGN(4K) : AT(ADDR(.userspace) - KERNEL_OFFSET)