1 use core::arch::asm; 2 3 /// @brief 获取当前cpu的apic id 4 #[inline] arch_current_apic_id() -> u85pub fn arch_current_apic_id() -> u8 { 6 let cpuid_res: u32; 7 unsafe { 8 asm!( 9 "mov eax, 1", 10 "cpuid", 11 "mov r15, ebx", 12 lateout("r15") cpuid_res 13 ); 14 } 15 return (cpuid_res >> 24) as u8; 16 } 17