From e1b3bd11cd088d70c945ddda76937b220b0082ad Mon Sep 17 00:00:00 2001 From: Jinke Fan Date: Mon, 3 Jun 2019 16:44:04 +0800 Subject: [PATCH] Add support for Hygon Dhyana CPU This patch is used to add support Hygon Dhyana x86 vendor id (HygonGenuine). More details can be found on: http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn Change-Id: I53445a8a63421811401b6a6a40e664d2600a3ec8 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1640959 Reviewed-by: Mark Mentovai --- compat/non_win/dbghelp.h | 2 +- minidump/minidump_system_info_writer.cc | 2 +- snapshot/linux/system_snapshot_linux_test.cc | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compat/non_win/dbghelp.h b/compat/non_win/dbghelp.h index 5ce88b88..ded912e7 100644 --- a/compat/non_win/dbghelp.h +++ b/compat/non_win/dbghelp.h @@ -214,7 +214,7 @@ union __attribute__((packed, aligned(4))) CPU_INFORMATION { //! `cpuid 0x80000001` `edx`. //! //! This field is only valid if #VendorId identifies the CPU vendor as - //! “AuthenticAMD”. + //! “AuthenticAMD” or "HygonGenuine". uint32_t AMDExtendedCpuFeatures; } X86CpuInfo; diff --git a/minidump/minidump_system_info_writer.cc b/minidump/minidump_system_info_writer.cc index 9bc013dc..06aeecda 100644 --- a/minidump/minidump_system_info_writer.cc +++ b/minidump/minidump_system_info_writer.cc @@ -151,7 +151,7 @@ void MinidumpSystemInfoWriter::InitializeFromSnapshot( SetCPUX86VersionAndFeatures(system_snapshot->CPUX86Signature(), system_snapshot->CPUX86Features() & 0xffffffff); - if (cpu_vendor == "AuthenticAMD") { + if (cpu_vendor == "AuthenticAMD" || cpu_vendor == "HygonGenuine") { SetCPUX86AMDExtendedFeatures( system_snapshot->CPUX86ExtendedFeatures() & 0xffffffff); } diff --git a/snapshot/linux/system_snapshot_linux_test.cc b/snapshot/linux/system_snapshot_linux_test.cc index 46d3845f..f3013b54 100644 --- a/snapshot/linux/system_snapshot_linux_test.cc +++ b/snapshot/linux/system_snapshot_linux_test.cc @@ -77,7 +77,8 @@ TEST(SystemSnapshotLinux, Basic) { EXPECT_PRED1( [](std::string vendor) { - return vendor == "GenuineIntel" || vendor == "AuthenticAMD"; + return vendor == "GenuineIntel" || vendor == "AuthenticAMD" || + vendor == "HygonGenuine"; }, system.CPUVendor());