1 use core::arch::asm;
2 
3 /// @brief 获取当前cpu的apic id
4 #[inline]
current_cpu_id() -> u85 pub fn current_cpu_id() -> u8 {
6     let cpuid_res: u32;
7     unsafe {
8         asm!(
9              "mov eax, 1",
10              "cpuid",
11              "mov r15, rbx",
12              lateout("r15") cpuid_res
13         );
14     }
15     return ((cpuid_res >> 24) & 0xff) as u8;
16 }
17 
18 /// @brief 通过pause指令,让cpu休息一会儿。降低空转功耗
cpu_relax()19 pub fn cpu_relax() {
20     unsafe {
21         asm!("pause");
22     }
23 }
24