[ZARCH] Restore detect() function

This commit is contained in:
maamountki 2018-08-06 20:03:49 +03:00 committed by GitHub
parent 23229011db
commit 453bfa7e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -45,9 +45,29 @@ static char *cpuname_lower[] = {
int detect(void) int detect(void)
{ {
// return CPU_GENERIC; FILE *infile;
return CPU_Z14; char buffer[512], *p;
p = (char *)NULL;
infile = fopen("/proc/sysinfo", "r");
while (fgets(buffer, sizeof(buffer), infile)){
if (!strncmp("Type", buffer, 4)){
p = strchr(buffer, ':') + 2;
#if 0
fprintf(stderr, "%s\n", p);
#endif
break;
}
}
fclose(infile);
if (strstr(p, "2964")) return CPU_Z13;
if (strstr(p, "2965")) return CPU_Z13;
if (strstr(p, "3906")) return CPU_Z14;
if (strstr(p, "3907")) return CPU_Z14;
return CPU_GENERIC;
} }
void get_libname(void) void get_libname(void)