Skip to content

Instantly share code, notes, and snippets.

@mikeb01
Created January 8, 2012 19:23
Show Gist options
  • Save mikeb01/1579376 to your computer and use it in GitHub Desktop.
Save mikeb01/1579376 to your computer and use it in GitHub Desktop.
#include <stdio.h>
static void cpuid(int op1, int op2, int *data) {
asm("cpuid"
: "=a" (data[0]), "=b" (data[1]), "=c" (data[3]), "=d" (data[2])
: "a"(op1), "c"(op2));
}
int main(int argc, char** argv) {
int values[5];
cpuid(0, 0, values);
printf("Vendor String: %s\n", (char*) &values[1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment