Clean up the frame buffer state in ostd::mm

This commit is contained in:
Zhang Junyang
2024-09-20 14:45:31 +08:00
committed by Tate, Hongliang Tian
parent 8b2ca77804
commit 9a79ecbcbe
4 changed files with 12 additions and 28 deletions

View File

@ -16,7 +16,7 @@ use core::{
use component::{init_component, ComponentInitError};
use font8x8::UnicodeFonts;
use ostd::{
boot,
boot::{self, memory_region::MemoryRegionType, memory_regions},
io_mem::IoMem,
mm::{VmIo, PAGE_SIZE},
sync::SpinLock,
@ -39,8 +39,10 @@ pub(crate) fn init() {
let mut writer = {
let framebuffer = boot::framebuffer_arg();
let mut size = 0;
for i in ostd::mm::FRAMEBUFFER_REGIONS.get().unwrap().iter() {
size = i.len();
for region in memory_regions() {
if region.typ() == MemoryRegionType::Framebuffer {
size = region.len();
}
}
let page_size = size / PAGE_SIZE;