[PATCH 21/23] ntdll: Add proper reporting of CPU information for PPC64 systems
André Hentschel
nerv at dawncrow.de
Sun Jan 31 11:34:31 CST 2021
From: Timothy Pearson <tpearson at raptorengineering.com>
Signed-off-by: André Hentschel <nerv at dawncrow.de>
---
dlls/ntdll/unix/system.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index f208dd915cc..3e5398c0cd4 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -469,7 +469,47 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
{
+#ifdef linux
+ char line[512];
+ char *s, *value;
+ FILE *f = fopen("/proc/cpuinfo", "r");
+ if (f)
+ {
+ while (fgets(line, sizeof(line), f) != NULL)
+ {
+ /* NOTE: the ':' is the only character we can rely on */
+ if (!(value = strchr(line,':')))
+ continue;
+ /* terminate the valuename */
+ s = value - 1;
+ while ((s >= line) && isspace(*s)) s--;
+ *(s + 1) = '\0';
+ /* and strip leading spaces from value */
+ value += 1;
+ while (isspace(*value)) value++;
+ if ((s = strchr(value,'\n')))
+ *s='\0';
+ if (!strcasecmp(line, "cpu"))
+ {
+ if (isdigit(value[5]))
+ info->Level = atoi(value+5);
+ continue;
+ }
+ if (!strcasecmp(line, "revision"))
+ {
+ if (isdigit(value[0]))
+ info->Revision = (atof(value) * 100);
+ continue;
+ }
+ }
+ fclose(f);
+ }
+#else
FIXME("CPU Feature detection not implemented.\n");
+#endif
+ info->Level = max(info->Level, 8); /* Default to POWER8 if unable to detect CPU series */
+ info->Architecture = PROCESSOR_ARCHITECTURE_PPC64;
+
}
#endif /* End architecture specific feature detection for CPUs */
--
2.25.1
More information about the wine-devel
mailing list