Merge pull request #3518 from laytan/sysinfo-arm-additions

sys/info: add arm feature detection, fix Linux implementation, show more CPU info on Darwin
This commit is contained in:
gingerBill authored and GitHub committed 2024-04-30 12:48:48 +01:00
commit eb06cb5d23
14 files changed
+356 -121

No files matched your search

+20 -7
View File
@@ -204,14 +204,27 @@ gb_internal void report_cpu_info() {
}
#elif defined(GB_CPU_ARM)
/*
TODO(Jeroen): On *nix, perhaps query `/proc/cpuinfo`.
*/
#if defined(GB_ARCH_64_BIT)
gb_printf("ARM64\n");
#else
gb_printf("ARM\n");
bool generic = true;
#if defined(GB_SYSTEM_OSX)
char cpu_name[128] = {};
size_t cpu_name_size = 128;
if (sysctlbyname("machdep.cpu.brand_string", &cpu_name, &cpu_name_size, nullptr, 0) == 0) {
generic = false;
gb_printf("%s\n", (char *)&cpu_name[0]);
}
#endif
if (generic) {
/*
TODO(Jeroen): On *nix, perhaps query `/proc/cpuinfo`.
*/
#if defined(GB_ARCH_64_BIT)
gb_printf("ARM64\n");
#else
gb_printf("ARM\n");
#endif
}
#else
gb_printf("Unknown\n");
#endif