mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-28 00:33:25 +00:00
Patch sched rust (#139)
* update * 添加rt调度器的rust初步实现 * 完善rt调度逻辑 * 调试rt调度器 * 修改sched的返回值 * cargo fmt 格式化 * 删除无用代码,修补rt bug * 删除无用的代码,和重复的逻辑 * 软中断bugfix * 删除一些代码 * 添加kthread_run_rt文档 * 解决sphinix警告_static目录不存在的问题 Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
@ -2,7 +2,7 @@ use core::arch::x86_64::_popcnt64;
|
||||
|
||||
/// @brief ffz - 寻找u64中的第一个0所在的位(从第0位开始寻找)
|
||||
/// 请注意,如果x中没有0,那么结果将是未定义的。请确保传入的x至少存在1个0
|
||||
///
|
||||
///
|
||||
/// @param x 目标u64
|
||||
/// @return i32 bit-number(0..63) of the first (least significant) zero bit.
|
||||
#[inline]
|
||||
|
@ -1,6 +1,6 @@
|
||||
pub mod irqflags;
|
||||
#[macro_use]
|
||||
pub mod current;
|
||||
pub mod ptrace;
|
||||
pub mod bitops;
|
||||
pub mod cmpxchg;
|
||||
pub mod cmpxchg;
|
||||
pub mod ptrace;
|
||||
|
@ -3,10 +3,10 @@ use crate::include::bindings::bindings::pt_regs;
|
||||
|
||||
/// @brief 判断给定的栈帧是否来自用户态
|
||||
/// 判断方法为:根据代码段选择子是否具有ring3的访问权限(低2bit均为1)
|
||||
pub fn user_mode(regs: *const pt_regs)->bool{
|
||||
if (unsafe{(*regs).cs} & 0x3) != 0{
|
||||
pub fn user_mode(regs: *const pt_regs) -> bool {
|
||||
if (unsafe { (*regs).cs } & 0x3) != 0 {
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,16 @@ use core::arch::asm;
|
||||
|
||||
/// @brief 关闭中断
|
||||
#[inline]
|
||||
pub fn cli(){
|
||||
unsafe{
|
||||
pub fn cli() {
|
||||
unsafe {
|
||||
asm!("cli");
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief 开启中断
|
||||
#[inline]
|
||||
pub fn sti(){
|
||||
unsafe{
|
||||
pub fn sti() {
|
||||
unsafe {
|
||||
asm!("sti");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,22 +2,22 @@
|
||||
use core::arch::asm;
|
||||
|
||||
#[inline(always)]
|
||||
pub fn mfence(){
|
||||
unsafe{
|
||||
pub fn mfence() {
|
||||
unsafe {
|
||||
asm!("mfence");
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn lfence(){
|
||||
unsafe{
|
||||
pub fn lfence() {
|
||||
unsafe {
|
||||
asm!("lfence");
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn sfence(){
|
||||
unsafe{
|
||||
pub fn sfence() {
|
||||
unsafe {
|
||||
asm!("sfence");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ pub fn switch_mm(
|
||||
mfence();
|
||||
// kdebug!("to get pml4t");
|
||||
let pml4t = unsafe { read_volatile(&next_pcb.mm.as_ref().unwrap().pgd) };
|
||||
|
||||
|
||||
unsafe {
|
||||
asm!("mov cr3, {}", in(reg) pml4t);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#[macro_use]
|
||||
pub mod asm;
|
||||
pub mod context;
|
||||
pub mod cpu;
|
||||
pub mod interrupt;
|
||||
pub mod mm;
|
||||
pub mod context;
|
||||
pub mod sched;
|
||||
pub mod sched;
|
||||
|
Reference in New Issue
Block a user