6 static inline uint64_t rdtsc(void)
9 asm volatile("rdtsc" : "=A" (v
));
13 static inline uint32_t rdtscl(void)
16 asm volatile("rdtsc" : "=a" (v
) : : "edx");
20 static inline uint32_t cpuid_eax(uint32_t level
)
24 asm("cpuid" : "=a" (v
) : "a" (level
) : "ebx", "ecx", "edx");
27 static inline uint32_t cpuid_ebx(uint32_t level
)
31 asm("cpuid" : "=b" (v
), "+a" (level
) : : "ecx", "edx");
34 static inline uint32_t cpuid_ecx(uint32_t level
)
38 asm("cpuid" : "=c" (v
), "+a" (level
) : : "ebx", "edx");
41 static inline uint32_t cpuid_edx(uint32_t level
)
45 asm("cpuid" : "=d" (v
), "+a" (level
) : : "ebx", "ecx");
49 static inline uint64_t rdmsr(uint32_t msr
)
53 asm volatile("rdmsr" : "=A" (v
) : "c" (msr
));
56 static inline void wrmsr(uint64_t v
, uint32_t msr
)
58 asm volatile("wrmsr" : : "A" (v
), "c" (msr
));
61 static inline void cpu_relax(void)
63 asm volatile("rep ; nop");
66 /* These are local cli/sti; not SMP-safe!!! */
68 static inline void cli(void)
73 static inline void sti(void)