xref: /DragonOS/kernel/src/arch/x86_64/cpu.rs (revision bacd691c9ef0502b5cc618aad50517f9e59df5e0)
1 use core::arch::asm;
2 
3 use super::asm::current::current_pcb;
4 
5 /// @brief 获取当前cpu的apic id
6 #[inline]
7 pub fn current_cpu_id() -> u32 {
8     // TODO: apic重构后,使用apic id来设置这里
9     current_pcb().cpu_id as u32
10 }
11 
12 /// @brief 通过pause指令,让cpu休息一会儿。降低空转功耗
13 pub fn cpu_relax() {
14     unsafe {
15         asm!("pause");
16     }
17 }
18