使mm支持4K虚拟地址映射

This commit is contained in:
fslongjin
2022-07-18 16:07:34 +08:00
parent 8b6489dac3
commit aa3f433cd5
10 changed files with 335 additions and 111 deletions

View File

@ -50,7 +50,7 @@ void init_frame_buffer(bool level)
sc_info.height = info.framebuffer_height;
sc_info.length = 1UL * sc_info.width * sc_info.height;
mm_map_proc_page_table(global_CR3, true, sc_info.fb_vaddr, sc_info.fb_paddr, get_VBE_FB_length() << 2, PAGE_KERNEL_PAGE | PAGE_PWT | PAGE_PCD, false, true);
mm_map_proc_page_table(global_CR3, true, sc_info.fb_vaddr, sc_info.fb_paddr, get_VBE_FB_length() << 2, PAGE_KERNEL_PAGE | PAGE_PWT | PAGE_PCD, false, true, false);
set_pos_VBE_FB_addr((uint *)sc_info.fb_vaddr);
}
else // 高级初始化,增加双缓冲区的支持
@ -58,7 +58,7 @@ void init_frame_buffer(bool level)
// 申请双重缓冲区
struct Page *p = alloc_pages(ZONE_NORMAL, PAGE_2M_ALIGN(sc_info.length << 2) / PAGE_2M_SIZE, 0);
sc_info.double_fb_vaddr = (uint64_t)phys_2_virt(p->addr_phys);
mm_map_proc_page_table(global_CR3, true, sc_info.double_fb_vaddr, p->addr_phys, PAGE_2M_ALIGN(sc_info.length << 2), PAGE_KERNEL_PAGE, false, true);
mm_map_proc_page_table(global_CR3, true, sc_info.double_fb_vaddr, p->addr_phys, PAGE_2M_ALIGN(sc_info.length << 2), PAGE_KERNEL_PAGE, false, true, false);
// 将原有的数据拷贝到double buffer里面
memcpy((void *)sc_info.double_fb_vaddr, (void *)sc_info.fb_vaddr, sc_info.length << 2);