From b404827f62c38e66ba72f1fc5ca2fb48b1ae54a5 Mon Sep 17 00:00:00 2001 From: zhouhanjie Date: Fri, 18 Aug 2023 11:35:45 +0000 Subject: [PATCH] ok --- kernel/src/libs/libUI/screen_manager.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/src/libs/libUI/screen_manager.rs b/kernel/src/libs/libUI/screen_manager.rs index 0eedbf389..9ccf57e89 100644 --- a/kernel/src/libs/libUI/screen_manager.rs +++ b/kernel/src/libs/libUI/screen_manager.rs @@ -4,7 +4,7 @@ use core::{ sync::atomic::{AtomicBool, AtomicU32, Ordering}, }; -use alloc::{collections::LinkedList, string::String, sync::Arc, vec::Vec}; +use alloc::{collections::LinkedList, string::String, sync::Arc, boxed::Box}; use crate::{ driver::uart::uart::{c_uart_send_str, UartPort}, @@ -51,7 +51,7 @@ pub enum ScmFramworkType { #[derive(Debug)] pub enum ScmBuffer { DeviceBuffer(Option), - DoubleBuffer(Option>), + DoubleBuffer(Option>), } #[derive(Debug)] pub struct ScmBufferInfo { @@ -106,13 +106,12 @@ impl ScmBufferInfo { ScmBufferInfo::from(unsafe { &video_frame_buffer_info }); frame_buffer_info.flags = buf_type; + // 这里还是改成使用box来存储数组,如果直接用vec存储,在multiboot2_iter那里会报错,不知为何 + frame_buffer_info.buf = ScmBuffer::DoubleBuffer(Some( + Box::new(vec![0; unsafe { (video_frame_buffer_info.size/4) as usize }]) + .into_boxed_slice(), + )); - frame_buffer_info.buf = ScmBuffer::DoubleBuffer(Some(vec![ - 0; - unsafe { - (video_frame_buffer_info.size / 4) as usize - } - ])); return Ok(frame_buffer_info); } }