4
1
mirror of https://github.com/DragonOS-Community/DragonOS.git synced 2025-06-19 21:36:30 +00:00

实现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
.github/workflows
docs/kernel/libs
kernel
Cargo.tomlMakefile
crates
system_error
unified-init
src
arch
driver
exception
filesystem
ipc
libs
mm
net
process
sched
smp
syscall
time
virt

@ -3,7 +3,9 @@
use core::{alloc::GlobalAlloc, fmt::Debug, ptr::Unique};
use crate::{arch::MMArch, mm::MemoryManagementArch, syscall::SystemError, KERNEL_ALLOCATOR};
use system_error::SystemError;
use crate::{arch::MMArch, mm::MemoryManagementArch, KERNEL_ALLOCATOR};
/// # AlignedBox
///

@ -6,6 +6,7 @@ use core::{
use alloc::vec::Vec;
use elf::{endian::AnyEndian, file::FileHeader, segment::ProgramHeader};
use system_error::SystemError;
use crate::{
arch::MMArch,
@ -23,10 +24,7 @@ use crate::{
exec::{BinaryLoader, BinaryLoaderResult, ExecError, ExecLoadMode, ExecParam},
ProcessManager,
},
syscall::{
user_access::{clear_user, copy_to_user},
SystemError,
},
syscall::user_access::{clear_user, copy_to_user},
};
use super::rwlock::RwLockWriteGuard;

@ -5,6 +5,7 @@ use alloc::{
use core::hash::{Hash, Hasher};
use core::{intrinsics::likely, sync::atomic::AtomicU64};
use hashbrown::HashMap;
use system_error::SystemError;
use crate::{
arch::{sched::sched, CurrentIrqArch, MMArch},
@ -12,7 +13,7 @@ use crate::{
libs::spinlock::{SpinLock, SpinLockGuard},
mm::{ucontext::AddressSpace, MemoryManagementArch, VirtAddr},
process::{ProcessControlBlock, ProcessManager},
syscall::{user_access::UserBufferReader, SystemError},
syscall::user_access::UserBufferReader,
time::{
timer::{next_n_us_timer_jiffies, Timer, WakeUpHelper},
TimeSpec,

@ -1,8 +1,6 @@
use crate::{
mm::VirtAddr,
syscall::{Syscall, SystemError},
time::TimeSpec,
};
use system_error::SystemError;
use crate::{mm::VirtAddr, syscall::Syscall, time::TimeSpec};
use super::{constant::*, futex::Futex};

@ -160,6 +160,9 @@ pub fn init_caster_map() {
unsafe { CASTER_MAP = Some(hashmap) };
}
#[cfg(not(target_os = "none"))]
pub fn init_caster_map() {}
fn cast_arc_panic<T: ?Sized + 'static>(_: Arc<dyn Any + Sync + Send>) -> Arc<T> {
panic!("Prepend [sync] to the list of target traits for Sync + Send types")
}

@ -5,6 +5,7 @@ use core::{
};
use alloc::{boxed::Box, collections::LinkedList, string::String, sync::Arc};
use system_error::SystemError;
use crate::{
driver::{
@ -12,7 +13,6 @@ use crate::{
},
libs::{lib_ui::textui::textui_is_enable_put_to_window, rwlock::RwLock, spinlock::SpinLock},
mm::VirtAddr,
syscall::SystemError,
};
use super::{

@ -8,7 +8,6 @@ use crate::{
rwlock::RwLock,
spinlock::{SpinLock, SpinLockGuard},
},
syscall::SystemError,
};
use alloc::{boxed::Box, collections::LinkedList, string::ToString};
use alloc::{sync::Arc, vec::Vec};
@ -18,6 +17,7 @@ use core::{
ops::{Add, AddAssign, Sub},
sync::atomic::{AtomicBool, AtomicI32, AtomicU32, Ordering},
};
use system_error::SystemError;
use super::{
screen_manager::{

@ -3,11 +3,10 @@ use core::{
sync::atomic::{AtomicI32, Ordering},
};
use crate::{
driver::{
tty::serial::serial8250::send_to_default_serial8250_port, video::video_refresh_manager,
},
syscall::SystemError,
use system_error::SystemError;
use crate::driver::{
tty::serial::serial8250::send_to_default_serial8250_port, video::video_refresh_manager,
};
use super::textui::{

@ -4,13 +4,13 @@ use core::{
};
use alloc::{collections::LinkedList, sync::Arc};
use system_error::SystemError;
use crate::{
arch::{sched::sched, CurrentIrqArch},
exception::InterruptArch,
libs::spinlock::SpinLockGuard,
process::{Pid, ProcessControlBlock, ProcessManager},
syscall::SystemError,
};
use super::spinlock::SpinLock;

@ -4,9 +4,9 @@ use core::fmt::Debug;
use crate::{
kwarn,
libs::{rwlock::RwLock, spinlock::SpinLock},
syscall::SystemError,
};
use alloc::{sync::Arc, vec::Vec};
use system_error::SystemError;
/// @brief 通知链节点
pub trait NotifierBlock<V: Clone + Copy, T>: Debug + Send + Sync {

@ -7,11 +7,12 @@ use core::{
sync::atomic::{AtomicU32, Ordering},
};
use system_error::SystemError;
use crate::{
arch::CurrentIrqArch,
exception::{InterruptArch, IrqFlagsGuard},
process::ProcessManager,
syscall::SystemError,
};
///RwLock读写锁

@ -1,6 +1,8 @@
use core::sync::atomic::{AtomicI32, Ordering};
use crate::{kdebug, process::ProcessManager, syscall::SystemError};
use system_error::SystemError;
use crate::{kdebug, process::ProcessManager};
use super::wait_queue::WaitQueue;

@ -9,7 +9,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
use crate::arch::CurrentIrqArch;
use crate::exception::{InterruptArch, IrqFlagsGuard};
use crate::process::ProcessManager;
use crate::syscall::SystemError;
use system_error::SystemError;
/// 实现了守卫的SpinLock, 能够支持内部可变性
///

@ -3,8 +3,9 @@
use core::mem::size_of;
use alloc::vec::Vec;
use system_error::SystemError;
use crate::{driver::base::block::SeekFrom, syscall::SystemError};
use crate::driver::base::block::SeekFrom;
/// @brief 本模块用于为数组提供游标的功能,以简化其操作。
#[derive(Debug)]