mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 11:16:47 +00:00
* update * 添加rt调度器的rust初步实现 * 完善rt调度逻辑 * 调试rt调度器 * 修改sched的返回值 * cargo fmt 格式化 * 删除无用代码,修补rt bug * 删除无用的代码,和重复的逻辑 * 软中断bugfix * 删除一些代码 * 添加kthread_run_rt文档 * 解决sphinix警告_static目录不存在的问题 Co-authored-by: longjin <longjin@RinGoTek.cn>
29 lines
734 B
Rust
29 lines
734 B
Rust
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;
|
|
}
|