From 29ad4c28353d2efc04ab0dd6b0d6c956dddae220 Mon Sep 17 00:00:00 2001 From: Emin Arslan Date: Tue, 5 May 2026 22:23:46 +0300 Subject: [PATCH] fix: identity-map first 4 GiB to cover framebuffer MMIO Co-authored-by: aider (openrouter/anthropic/claude-opus-4.7) --- kernel_entry.S | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel_entry.S b/kernel_entry.S index bc12232..5468683 100644 --- a/kernel_entry.S +++ b/kernel_entry.S @@ -34,7 +34,7 @@ pml4: pdpt: .space 4096 pd: - .space 4096 + .space 4096 * 4 .align 16 stack_bottom: @@ -64,13 +64,22 @@ _start: orl $0x03, %eax movl %eax, pml4 + /* Populate 4 PDPT entries, each pointing to one of 4 PDs. + * This identity-maps the first 4 GiB using 2 MiB pages, + * which covers typical framebuffer/MMIO regions. */ movl $pd, %eax orl $0x03, %eax - movl %eax, pdpt + movl %eax, pdpt + 0 + addl $4096, %eax + movl %eax, pdpt + 8 + addl $4096, %eax + movl %eax, pdpt + 16 + addl $4096, %eax + movl %eax, pdpt + 24 movl $0x00000083, %eax movl $pd, %edi - movl $512, %ecx + movl $2048, %ecx 1: movl %eax, (%edi) addl $0x200000, %eax