实现屏幕管理器大致的框架

This commit is contained in:
fslongjin
2022-08-03 14:11:14 +08:00
parent fadeee36a2
commit de3324ed7d
9 changed files with 514 additions and 98 deletions

View File

@ -103,38 +103,17 @@ int printk_init(const int char_size_x, const int char_size_y)
// 初始化自旋锁
spin_init(&printk_lock);
// ======== 临时的将物理地址填写到0x0000000003000000处 之后会在mm内将帧缓存区重新映射=====
ul global_CR3 = (ul)get_CR3();
ul fb_virt_addr = (ul)pos.FB_address;
ul fb_phys_addr = VBE_FB_phys_addr;
// 计算帧缓冲区的线性地址对应的pml4页表项的地址
ul *tmp = phys_2_virt((ul *)((ul)global_CR3 & (~0xfffUL)) + ((fb_virt_addr >> PAGE_GDT_SHIFT) & 0x1ff));
tmp = phys_2_virt((ul *)(*tmp & (~0xfffUL)) + ((fb_virt_addr >> PAGE_1G_SHIFT) & 0x1ff));
ul *tmp1;
// 初始化2M物理页
for (ul i = 0; i < (pos.FB_length << 2); i += PAGE_2M_SIZE)
{
// 计算当前2M物理页对应的pdt的页表项的物理地址
tmp1 = phys_2_virt((ul *)(*tmp & (~0xfffUL)) + (((fb_virt_addr + i) >> PAGE_2M_SHIFT) & 0x1ff));
// 页面写穿,禁止缓存
set_pdt(tmp1, mk_pdt((ul)fb_phys_addr + i, PAGE_KERNEL_PAGE | PAGE_PWT | PAGE_PCD));
}
flush_tlb();
pos.x = 0;
pos.y = 0;
cls();
io_mfence();
kdebug("width=%d\theight=%d", pos.width, pos.height);
// 由于此时系统并未启用双缓冲,因此关闭滚动动画
printk_disable_animation();
io_mfence();
return 0;
}
@ -960,4 +939,3 @@ int sprintk(char *buf, const char *fmt, ...)
return count;
}