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