x86: add inline CPUID instruction
This commit is contained in:
parent
637ac5ce92
commit
eba1c83c2f
1 changed files with 16 additions and 0 deletions
|
@ -74,6 +74,22 @@ static __always_inline void halt(void)
|
|||
__asm__ volatile("hlt");
|
||||
}
|
||||
|
||||
struct x86_cpuid_ret {
|
||||
u32 eax;
|
||||
u32 ebx;
|
||||
u32 ecx;
|
||||
u32 edx;
|
||||
};
|
||||
|
||||
static inline void x86_cpuid(struct x86_cpuid_ret *ret, u32 eax, u32 ecx)
|
||||
{
|
||||
__asm__ volatile(
|
||||
"cpuid"
|
||||
: "=a"(ret->eax), "=b"(ret->ebx), "=c"(ret->ecx), "=d"(ret->edx)
|
||||
: "0"(eax), "c"(ecx)
|
||||
);
|
||||
}
|
||||
|
||||
static __always_inline void x86_pause(void)
|
||||
{
|
||||
__asm__ volatile("pause");
|
||||
|
|
Loading…
Reference in a new issue