cpuid.h 350 B

12345678910111213141516171819
  1. #ifndef __CPUID_H
  2. #define __CPUID_H
  3. typedef struct
  4. {
  5. UInt32 eax, ebx, ecx, edx;
  6. } cpuid_result_t;
  7. static inline void cpuid(UInt32 eax, UInt32 ecx, cpuid_result_t &res)
  8. {
  9. __asm__ __volatile__ (
  10. "cpuid\n"
  11. : "=a" (res.eax), "=b" (res.ebx), "=c" (res.ecx), "=d" (res.edx)
  12. : "a" (eax), "c" (ecx)
  13. );
  14. }
  15. #endif // __CPUID_H