mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
Detecting CPU vendor. Support for printing ascii
This commit is contained in:
13
extended.c
13
extended.c
@@ -1,17 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "extended.h"
|
||||
|
||||
char* getString_CPUName() {
|
||||
unsigned eax, ebx, ecx, edx;
|
||||
char* name = malloc(sizeof(char)*64);
|
||||
memset(name,0,64);
|
||||
|
||||
//First, check we can use extended
|
||||
eax = 0x80000000;
|
||||
cpuid(&eax, &ebx, &ecx, &edx);
|
||||
if(eax < 0x80000001)
|
||||
return NULL;
|
||||
if(eax < 0x80000001) {
|
||||
sprintf(name,"Unknown");
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
//We can, fetch name
|
||||
char* name = malloc(sizeof(char)*64);
|
||||
|
||||
eax = 0x80000002;
|
||||
cpuid(&eax, &ebx, &ecx, &edx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user