Skip to content

Instantly share code, notes, and snippets.

@vxcute
Created October 31, 2020 20:48
Show Gist options
  • Save vxcute/bdd87bfbcdbdc568119044ca0725f942 to your computer and use it in GitHub Desktop.
Save vxcute/bdd87bfbcdbdc568119044ca0725f942 to your computer and use it in GitHub Desktop.
// Simple Example to Demostrate working of cpuid by priting the cpu vendor name using inline assembly
#include <stdio.h>
int main()
{
char cpuVendor[20];
char* CPUvendor = (char*)cpuVendor;
__asm {
mov edi, CPUvendor;
mov eax, 0
cpuid
mov [edi], ebx
mov [edi+4], edx
mov [edi+8], ecx
}
cpuVendor[12] = 0;
printf("CPU Vendor Name is: %s", cpuVendor);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment