Skip to content

Commit 09b4830

Browse files
committed
add Hygon Dhyana support hyperic#129
1 parent a053a7b commit 09b4830

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

go_bindings/Sigar/src/os/win32/win32_sigar.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,6 +2214,8 @@ static int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info)
22142214
else {
22152215
if (strEQ(info->vendor, "AuthenticAMD")) {
22162216
SIGAR_SSTRCPY(info->vendor, "AMD");
2217+
} else if (strEQ(info->vendor, "HygonGenuine")) {
2218+
SIGAR_SSTRCPY(info->vendor, "Hygon");
22172219
}
22182220
}
22192221

src/os/linux/linux_sigar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,9 @@ static int get_cpu_info(sigar_t *sigar, sigar_cpu_info_t *info,
15651565
else if (strEQ(info->vendor, "AuthenticAMD")) {
15661566
SIGAR_SSTRCPY(info->vendor, "AMD");
15671567
}
1568+
else if (strEQ(info->vendor, "HygonGenuine")) {
1569+
SIGAR_SSTRCPY(info->vendor, "Hygon");
1570+
}
15681571
}
15691572
break;
15701573
case 'f':

src/os/win32/win32_sigar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,6 +2282,9 @@ static int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info)
22822282
if (strEQ(info->vendor, "AuthenticAMD")) {
22832283
SIGAR_SSTRCPY(info->vendor, "AMD");
22842284
}
2285+
else if (strEQ(info->vendor, "HygonGenuine")) {
2286+
SIGAR_SSTRCPY(info->vendor, "Hygon");
2287+
}
22852288
}
22862289

22872290
size = sizeof(info->model);

src/sigar_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ static void sigar_cpuid(sigar_uint32_t request,
554554

555555
#define INTEL_ID 0x756e6547
556556
#define AMD_ID 0x68747541
557+
#define HYGON_ID 0x6f677948
557558

558559
int sigar_cpu_core_count(sigar_t *sigar)
559560
{
@@ -565,7 +566,7 @@ int sigar_cpu_core_count(sigar_t *sigar)
565566

566567
sigar_cpuid(0, &id);
567568

568-
if ((id.ebx == INTEL_ID) || (id.ebx == AMD_ID)) {
569+
if ((id.ebx == INTEL_ID) || (id.ebx == AMD_ID) || (id.ebx == HYGON_ID)) {
569570
sigar_cpuid(1, &id);
570571

571572
if (id.edx & (1<<28)) {

0 commit comments

Comments
 (0)