1 // X86 utility functions.
3 // Copyright (C) 2013 Kevin O'Connor <kevin@koconnor.net>
5 // This file may be distributed under the terms of the GNU LGPLv3 license.
7 #include "x86.h" // __cpuid
10 cpuid(u32 index, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
13 u32 origflags = save_flags();
14 restore_flags(origflags ^ F_ID);
15 u32 newflags = save_flags();
16 restore_flags(origflags);
18 if (((origflags ^ newflags) & F_ID) != F_ID)
20 *eax = *ebx = *ecx = *edx = 0;
22 __cpuid(index, eax, ebx, ecx, edx);