Created
October 31, 2020 20:48
-
-
Save vxcute/bdd87bfbcdbdc568119044ca0725f942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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