Use MSR to map framebuffer as WC (write-combining) = huge speed diff on real HW

This commit is contained in:
2026-03-19 19:34:31 +01:00
parent 6a82d581fb
commit 424b4c4632
6 changed files with 133 additions and 2 deletions
+2 -2
View File
@@ -202,9 +202,9 @@ void paging_init(struct boot_context boot_ctx)
uint64_t fb_size = fb->pitch * fb->height;
uint64_t fb_pages = (fb_size + PAGE_SIZE-1)/PAGE_SIZE;
// Map the framebuffer (with cache-disable & write-through)
// Map the framebuffer (PWT set, and no PCD means PAT1 [Write-Combining] for this region)
for (uint64_t i=0; i<fb_pages; i++) {
paging_map_page(kernel_pml4, fb_virt+i*PAGE_SIZE, fb_phys+i*PAGE_SIZE, PTE_WRITABLE | PTE_PCD | PTE_PWT);
paging_map_page(kernel_pml4, fb_virt+i*PAGE_SIZE, fb_phys+i*PAGE_SIZE, PTE_WRITABLE | PTE_PWT);
page_count++;
}
DEBUG("Mapped %u pages for framebuffer", page_count);