mac arm64: Provide something more useful from SystemSnapshot::CPURevison

hw.cputype is just CPU_TYPE_ARM64, which isn’t terribly useful.
hw.cpufamily is somewhat better as it uses <mach/machine.h> CPUFAMILY_*
values, which distinguish between different CPU generations.
CPUFAMILY_ARM_VORTEX_TEMPEST identifies A12, for example. (The fun cores
are Vortex and the boring cores are Tempest.)

Bug: crashpad:345
Change-Id: I88be4fa0b305b2fa15bd24358f63dc7d72192b27
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2289041
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Mark Mentovai 2020-07-08 21:32:47 -04:00 committed by Commit Bot
parent 030c58c295
commit 498c36b82a

View File

@ -178,10 +178,8 @@ uint32_t SystemSnapshotMac::CPURevision() const {
return (family << 16) | (model << 8) | stepping;
#elif defined(ARCH_CPU_ARM64)
// TODO(macos_arm64): Verify that this is correct, and pack more information
// if feasible. The Apple A12Z returns hw.cputype = 0x100000c and
// hw.cpusubtype = 2.
return CastIntSysctlByName<uint32_t>("hw.cputype", 0);
// TODO(macos_arm64): Verify and test.
return CastIntSysctlByName<uint32_t>("hw.cpufamily", 0);
#else
#error port to your architecture
#endif