=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: ntdll: Parse ARM64 CPU info.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri May 22 04:48:24 CDT 2015
Module: wine
Branch: master
Commit: b5b34220cc8d0c232f7b47f63440696604706eed
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b5b34220cc8d0c232f7b47f63440696604706eed
Author: André Hentschel <nerv at dawncrow.de>
Date: Thu May 21 16:13:35 2015 +0200
ntdll: Parse ARM64 CPU info.
---
dlls/ntdll/nt.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 550a91a..8e6ce06 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1146,7 +1146,54 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
{
- info->Level = 8;
+#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 architecture"))
+ {
+ if (isdigit(value[0]))
+ info->Level = atoi(value);
+ continue;
+ }
+ if (!strcasecmp(line, "CPU revision"))
+ {
+ if (isdigit(value[0]))
+ info->Revision = atoi(value);
+ continue;
+ }
+ if (!strcasecmp(line, "Features"))
+ {
+ if (strstr(value, "crc32"))
+ user_shared_data->ProcessorFeatures[PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE] = TRUE;
+ if (strstr(value, "aes"))
+ user_shared_data->ProcessorFeatures[PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE] = TRUE;
+ continue;
+ }
+ }
+ fclose(f);
+ }
+#else
+ FIXME("CPU Feature detection not implemented.\n");
+#endif
+ info->Level = max(info->Level, 8);
+ user_shared_data->ProcessorFeatures[PF_ARM_V8_INSTRUCTIONS_AVAILABLE] = TRUE;
info->Architecture = PROCESSOR_ARCHITECTURE_ARM64;
}
More information about the wine-cvs
mailing list