Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char vendor[13];
- __asm__ __volatile__(
- "pushfl \n\t"
- "pushfl \n\t"
- "xorl $0x200000, (%esp)\n\t"
- "popfl \n\t"
- "pushfl \n\t"
- "popl %eax \n\t"
- "xorl %eax,(%esp) \n\t"
- "pushl %eax \n\t"
- "popfl \n\t"
- "pushfl \n\t"
- "popl %eax \n\t"
- );
- register unsigned int eax __asm__("%eax");
- register unsigned int ecx __asm__("%ecx");
- if (eax != ecx)
- return;
- ((unsigned int*)vendor)[0] = cpuid_getreg(0, CR_EBX);
- ((unsigned int*)vendor)[1] = cpuid_getreg(0, CR_EDX);
- ((unsigned int*)vendor)[2] = cpuid_getreg(0, CR_ECX);
- /* null termination */
- vendor[12] = '\0';
- console_print("CPU Vendor: %s\n", vendor);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement