2 * Routines to report CPU information
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <wsutil/ws_cpuid.h>
17 #include <wsutil/cpu_info.h>
20 * Get the CPU info, and append it to the GString
23 get_cpu_info(GString *str)
26 char CPUBrandString[0x40];
29 /* http://msdn.microsoft.com/en-us/library/hskdteyh(v=vs.100).aspx */
31 /* Calling __cpuid with 0x80000000 as the InfoType argument */
32 /* gets the number of valid extended IDs. */
33 if (!ws_cpuid(CPUInfo, 0x80000000))
38 if (nExIds<0x80000005)
41 memset(CPUBrandString, 0, sizeof(CPUBrandString));
43 /* Interpret CPU brand string */
44 ws_cpuid(CPUInfo, 0x80000002);
45 memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
46 ws_cpuid(CPUInfo, 0x80000003);
47 memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
48 ws_cpuid(CPUInfo, 0x80000004);
49 memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
52 g_string_append(str, ", with ");
54 g_string_append_printf(str, "%s", CPUBrandString);
57 g_string_append(str, " (with SSE4.2)");
61 * Editor modelines - http://www.wireshark.org/tools/modelines.html
66 * indent-tabs-mode: nil
69 * vi: set shiftwidth=4 tabstop=8 expandtab:
70 * :indentSize=4:tabSize=8:noTabs=true: