mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-13 19:26:47 +00:00
* Block io调度器 * process_wakeup时,对cfs的进程,重设虚拟运行时间。解决由于休眠的进程,其虚拟运行时间过小,导致其他进程饥饿的问题 * 1、为AP核启动apic_timer,使其能够运行调度 2、增加kick_cpu功能,支持让某个特定核心立即运行调度器 3、wait_queue的唤醒,改为立即唤醒。 4、增加进程在核心间迁移的功能 5、CFS调度器为每个核心设置单独的IDLE进程pcb(pid均为0) 6、pcb中增加migrate_to字段 7、当具有多核时,io调度器在核心1上运行。 * io调度器文件位置修改 * 修改io的makefile * 更新makefile中的变量名 * 修改io调度器函数名 --------- Co-authored-by: login <longjin@ringotek.cn>
92 lines
2.0 KiB
Rust
92 lines
2.0 KiB
Rust
#![no_std] // <1>
|
||
#![no_main] // <1>
|
||
#![feature(const_mut_refs)]
|
||
#![feature(core_intrinsics)] // <2>
|
||
#![feature(alloc_error_handler)]
|
||
#![feature(panic_info_message)]
|
||
#![feature(drain_filter)] // 允许Vec的drain_filter特性
|
||
#![feature(c_void_variant)] // used in kernel/src/exception/softirq.rs
|
||
#[allow(non_upper_case_globals)]
|
||
#[allow(non_camel_case_types)]
|
||
#[allow(non_snake_case)]
|
||
use core::panic::PanicInfo;
|
||
|
||
/// 导出x86_64架构相关的代码,命名为arch模块
|
||
#[cfg(target_arch = "x86_64")]
|
||
#[path = "arch/x86_64/mod.rs"]
|
||
#[macro_use]
|
||
mod arch;
|
||
|
||
mod driver;
|
||
mod filesystem;
|
||
#[macro_use]
|
||
mod include;
|
||
mod ipc;
|
||
#[macro_use]
|
||
mod libs;
|
||
mod exception;
|
||
pub mod io;
|
||
mod mm;
|
||
mod process;
|
||
mod sched;
|
||
mod smp;
|
||
mod time;
|
||
|
||
extern crate alloc;
|
||
|
||
use mm::allocator::KernelAllocator;
|
||
|
||
// <3>
|
||
use crate::{
|
||
arch::asm::current::current_pcb,
|
||
include::bindings::bindings::{process_do_exit, BLACK, GREEN},
|
||
};
|
||
|
||
// 声明全局的slab分配器
|
||
#[cfg_attr(not(test), global_allocator)]
|
||
pub static KERNEL_ALLOCATOR: KernelAllocator = KernelAllocator {};
|
||
|
||
/// 全局的panic处理函数
|
||
#[panic_handler]
|
||
#[no_mangle]
|
||
pub fn panic(info: &PanicInfo) -> ! {
|
||
kerror!("Kernel Panic Occurred.");
|
||
|
||
match info.location() {
|
||
Some(loc) => {
|
||
println!(
|
||
"Location:\n\tFile: {}\n\tLine: {}, Column: {}",
|
||
loc.file(),
|
||
loc.line(),
|
||
loc.column()
|
||
);
|
||
}
|
||
None => {
|
||
println!("No location info");
|
||
}
|
||
}
|
||
|
||
match info.message() {
|
||
Some(msg) => {
|
||
println!("Message:\n\t{}", msg);
|
||
}
|
||
None => {
|
||
println!("No panic message.");
|
||
}
|
||
}
|
||
|
||
println!("Current PCB:\n\t{:?}", current_pcb());
|
||
unsafe {
|
||
process_do_exit(u64::MAX);
|
||
};
|
||
loop {}
|
||
}
|
||
|
||
/// 该函数用作测试,在process.c的initial_kernel_thread()中调用了此函数
|
||
#[no_mangle]
|
||
pub extern "C" fn __rust_demo_func() -> i32 {
|
||
printk_color!(GREEN, BLACK, "__rust_demo_func()\n");
|
||
|
||
return 0;
|
||
}
|