Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void cpu_chk()
- {
- uint32_t returnEAX;
- 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 (%esp), %eax \n\t"
- "popfl \n\t"
- : "=a" (returnEAX) );
- if (eax == 0) 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 0x%X\n", vendor, eax);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement