Skip to content

Instantly share code, notes, and snippets.

@scottmac
Created October 19, 2010 20:39
Show Gist options
  • Save scottmac/635060 to your computer and use it in GitHub Desktop.
Save scottmac/635060 to your computer and use it in GitHub Desktop.
static __inline void do_cpuid(u_int ax, u_int *p) {
__asm __volatile("pushl %%ebx\n\t"
"cpuid\n\t"
"movl %%ebx, %%esi\n\t"
"popl %%ebx\n\t"
: "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3])
: "a" (ax));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment