xref: /DragonOS/kernel/src/arch/x86_64/cpu.rs (revision 728aca308917a7d4d0ba10fe8174e9408d77a9a6)
1 use core::arch::asm;
2 
3 /// @brief 获取当前cpu的apic id
4 #[inline]
5 pub 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