Advertisement
Guest User

CPUID test

a guest
Jun 30th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. int main()
  5. {
  6.     uint32_t edx;
  7.     uint32_t ecx;
  8.     int i;
  9.  
  10.     asm ("movl $1, %%eax\n"
  11.          "cpuid\n"
  12.          "movl %%edx, %0\n"
  13.          "movl %%ecx, %1\n"
  14.          : "=r"(edx), "=r"(ecx));
  15.  
  16.     printf ("EDX ");
  17.     for (i=0; i<32; i++)
  18.     {
  19.         if (!(edx & (1<<i))) printf ("%i ", i);
  20.     }
  21.  
  22.     printf ("\nECX ");
  23.    
  24.     for (i=0; i<32; i++)
  25.     {
  26.         if (!(ecx & (1<<i))) printf ("%i ", i);
  27.     }
  28.    
  29.     printf ("\n");
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement