实现unified-init库,支持收集初始化函数到一个数组,并统一初始化 (#474)

* 添加“统一初始化”的过程宏,并把SystemError独立成crate

* 使用unified-init来初始化fbmem

* 更新workflow,增加内核自动化静态测试
This commit is contained in:
LoGin
2023-12-25 23:12:27 +08:00
committed by GitHub
parent f110d330d5
commit 91e9d4ab55
158 changed files with 1102 additions and 610 deletions

View File

@ -2,6 +2,7 @@ use alloc::{
string::{String, ToString},
sync::{Arc, Weak},
};
use system_error::SystemError;
use crate::{
driver::base::{
@ -19,7 +20,6 @@ use crate::{
rwlock::{RwLockReadGuard, RwLockWriteGuard},
spinlock::SpinLock,
},
syscall::SystemError,
};
use super::fbmem::sys_class_graphics_instance;

View File

@ -2,15 +2,15 @@ use alloc::{
string::ToString,
sync::{Arc, Weak},
};
use system_error::SystemError;
use unified_init::macros::unified_init;
use crate::{
driver::base::{
class::{class_manager, Class},
device::sys_dev_char_kset,
kobject::KObject,
subsys::SubSysPrivate,
},
syscall::SystemError,
use crate::driver::base::{
class::{class_manager, Class},
device::sys_dev_char_kset,
init::SUBSYSTEM_INITIALIZER_SLICE,
kobject::KObject,
subsys::SubSysPrivate,
};
use super::fbcon::fb_console_init;
@ -26,6 +26,7 @@ pub fn sys_class_graphics_instance() -> Option<&'static Arc<GraphicsClass>> {
}
/// 初始化帧缓冲区子系统
#[unified_init(SUBSYSTEM_INITIALIZER_SLICE)]
pub fn fbmem_init() -> Result<(), SystemError> {
let graphics_class = GraphicsClass::new();
class_manager().class_register(&(graphics_class.clone() as Arc<dyn Class>))?;

View File

@ -1,9 +1,9 @@
use alloc::{string::String, sync::Arc};
use system_error::SystemError;
use crate::{
driver::base::device::Device,
mm::{ucontext::LockedVMA, PhysAddr},
syscall::SystemError,
};
pub mod fbcon;

View File

@ -4,8 +4,6 @@ use core::{
sync::atomic::{AtomicBool, Ordering},
};
use alloc::{boxed::Box, sync::Arc};
use crate::{
arch::MMArch,
driver::tty::serial::serial8250::send_to_default_serial8250_port,
@ -24,9 +22,10 @@ use crate::{
allocator::page_frame::PageFrameCount, kernel_mapper::KernelMapper,
no_init::pseudo_map_phys, page::PageFlags, MemoryManagementArch, PhysAddr, VirtAddr,
},
syscall::SystemError,
time::timer::{Timer, TimerFunction},
};
use alloc::{boxed::Box, sync::Arc};
use system_error::SystemError;
pub mod fbdev;