使用Rust重构CFS调度器 (#131)

* 新建调度器的文件

* 把softirq vector移动到c文件中(原来在.h)

* 将进程切换方式改为“中断返回时切换”

* new:使用rust重构CFS

* 删除已经在smp中废弃的HPET中断转发函数

* 代码格式化

* 删除多余的dunce依赖
This commit is contained in:
login
2022-12-31 17:26:12 +08:00
committed by GitHub
parent 156949680c
commit d4f3de93a2
37 changed files with 464 additions and 1027 deletions

View File

@ -0,0 +1,28 @@
pub mod barrier;
use crate::include::bindings::bindings::process_control_block;
use core::arch::asm;
use core::ptr::read_volatile;
use self::barrier::mfence;
/// @brief 切换进程的页表
///
/// @param 下一个进程的pcb。将会把它的页表切换进来。
///
/// @return 下一个进程的pcb(把它return的目的主要是为了归还所有权)
#[inline(always)]
#[allow(dead_code)]
pub fn switch_mm(
next_pcb: &'static mut process_control_block,
) -> &'static mut process_control_block {
mfence();
// kdebug!("to get pml4t");
let pml4t = unsafe { read_volatile(&next_pcb.mm.as_ref().unwrap().pgd) };
unsafe {
asm!("mov cr3, {}", in(reg) pml4t);
}
mfence();
return next_pcb;
}