Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. static unsigned int cpuid_getreg(unsigned int f, int reg)
  2. {
  3.     __asm__ (
  4.         "movl %0, %%eax" : : \
  5.         "r" (f) : "%eax" );
  6.     __asm__ (
  7.         "cpuid"
  8.     );
  9.  
  10.     switch(reg)
  11.     {
  12.         case MCR_EAX: { register unsigned int t __asm__("%eax"); return t; }
  13.         case MCR_EBX: { register unsigned int t __asm__("%ebx"); return t; }
  14.         case MCR_ECX: { register unsigned int t __asm__("%ecx"); return t; }
  15.         case MCR_EDX: { register unsigned int t __asm__("%edx"); return t; }
  16.         default:
  17.             return 0;
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement