Skip to content

Commit 453bfa7

Browse files
authored
[ZARCH] Restore detect() function
1 parent 2322901 commit 453bfa7

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

cpuid_zarch.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,29 @@ static char *cpuname_lower[] = {
4545

4646
int detect(void)
4747
{
48-
// return CPU_GENERIC;
49-
return CPU_Z14;
50-
48+
FILE *infile;
49+
char buffer[512], *p;
50+
51+
p = (char *)NULL;
52+
infile = fopen("/proc/sysinfo", "r");
53+
while (fgets(buffer, sizeof(buffer), infile)){
54+
if (!strncmp("Type", buffer, 4)){
55+
p = strchr(buffer, ':') + 2;
56+
#if 0
57+
fprintf(stderr, "%s\n", p);
58+
#endif
59+
break;
60+
}
61+
}
62+
63+
fclose(infile);
64+
65+
if (strstr(p, "2964")) return CPU_Z13;
66+
if (strstr(p, "2965")) return CPU_Z13;
67+
if (strstr(p, "3906")) return CPU_Z14;
68+
if (strstr(p, "3907")) return CPU_Z14;
69+
70+
return CPU_GENERIC;
5171
}
5272

5373
void get_libname(void)

0 commit comments

Comments
 (0)