Skip to content

Commit 6fd0f63

Browse files
hygonsocgnzlbg
authored andcommitted
add Hygon Dhyana CPU Vendor ID("HygonGenuine") checking
As Hygon Dhyana originates from AMD technology and shares most of the architecture with AMD's family 17h, but with different CPU Vendor ID("HygonGenuine")/Family series number(Family 18h). for CPUID feature bits, Hygon Dhyana(family 18h) share the same definition with AMD family 17h. AMD CPUID specification is https://www.amd.com/system/files/TechDocs/25481.pdf. Related Hygon kernel patch can be found on http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn
1 parent b7cb47b commit 6fd0f63

File tree

1 file changed

+12
-2
lines changed
  • crates/std_detect/src/detect/os

1 file changed

+12
-2
lines changed

crates/std_detect/src/detect/os/x86.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,18 @@ fn detect_features() -> cache::Initializer {
234234
// The `is_x86_feature_detected!("lzcnt")` macro then
235235
// internally maps to Feature::abm.
236236
enable(extended_proc_info_ecx, 5, Feature::abm);
237-
if vendor_id == *b"AuthenticAMD" {
238-
// These features are only available on AMD CPUs:
237+
// As Hygon Dhyana originates from AMD technology and shares most of the architecture with
238+
// AMD's family 17h, but with different CPU Vendor ID("HygonGenuine")/Family series
239+
// number(Family 18h).
240+
//
241+
// For CPUID feature bits, Hygon Dhyana(family 18h) share the same definition with AMD
242+
// family 17h.
243+
//
244+
// Related AMD CPUID specification is https://www.amd.com/system/files/TechDocs/25481.pdf.
245+
// Related Hygon kernel patch can be found on
246+
// http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn
247+
if vendor_id == *b"AuthenticAMD" || vendor_id == *b"HygonGenuine" {
248+
// These features are available on AMD arch CPUs:
239249
enable(extended_proc_info_ecx, 6, Feature::sse4a);
240250
enable(extended_proc_info_ecx, 21, Feature::tbm);
241251
}

0 commit comments

Comments
 (0)