Merge pull request #1164 from sharkcz/s390x

detect CPU on zArch
This commit is contained in:
Martin Kroeker 2017-04-21 10:53:49 +02:00 committed by GitHub
commit da0987507c
1 changed files with 21 additions and 3 deletions

View File

@ -42,9 +42,27 @@ static char *cpuname_lower[] = {
int detect(void)
{
// return CPU_GENERIC;
return CPU_Z13;
FILE *infile;
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;
return CPU_GENERIC;
}
void get_libname(void)