assembly - How to recognize cpu brand name in c/assembler by cpuid instruction -
i have no idea how should program work, found codes don't understand them, if here kind , had program explain me?
#include <stdio.h> #include <string.h> int main() { char name[13]; __asm { xor eax,eax cpuid mov dword ptr [name], ebx mov dword ptr [name+4], edx mov dword ptr [name+8], ecx } name[12]=0; printf("procesor: %s\n", name); getchar(); return 0; }
the cpuid
instruction tells various things cpu depending on content of eax
register. when eax
contains zero, registers ebx
, edx
, , ecx
contain string describing processor's vendor. code have pulls string registers , prints out.
read wikipedia further details on cpuid
.
Comments
Post a Comment