新增rust版本的lockref (#135)

* new:Rust封装cpu_relax(),通过pause指令,让cpu休息一会儿。降低空转功耗

* new: Rust版本的lockref

* Rust的RawSpinlock新增is_locked()和set_value()方法。

* lockref文档
This commit is contained in:
login
2023-01-03 23:09:25 +08:00
committed by GitHub
parent 2726f101b4
commit 61de2cdc3f
10 changed files with 557 additions and 7 deletions

View File

@ -14,3 +14,10 @@ pub fn arch_current_apic_id() -> u8 {
}
return (cpuid_res >> 24) as u8;
}
/// @brief 通过pause指令让cpu休息一会儿。降低空转功耗
pub fn cpu_relax() {
unsafe {
asm!("pause");
}
}