Files
DragonOS/kernel/src/arch/x86_64/cpu.rs
login bacd691c9e 软中断&定时器重构 (#223)
* 软中断&定时器重构

Co-authored-by: houmkh<houjiaying@DragonOS.org>

* 修改timer的clock()

* 删除debug信息

---------

Co-authored-by: houmkh <1119644616@qq.com>
2023-04-02 17:09:33 +08:00

18 lines
373 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

use core::arch::asm;
use super::asm::current::current_pcb;
/// @brief 获取当前cpu的apic id
#[inline]
pub fn current_cpu_id() -> u32 {
// TODO: apic重构后使用apic id来设置这里
current_pcb().cpu_id as u32
}
/// @brief 通过pause指令让cpu休息一会儿。降低空转功耗
pub fn cpu_relax() {
unsafe {
asm!("pause");
}
}