mcst-linux-kernel/patches-2024.06.26/cpufrequtils-008/0001-Patch-from-debian-Only...

42 lines
910 B
Diff

From c872c08751adf5ea28577b33ee955da8eadcf2a1 Mon Sep 17 00:00:00 2001
Date: Fri, 15 Jun 2018 20:15:40 +0300
Subject: [PATCH] Patch from debian: Only x86 has cpuid instruction
---
utils/aperf.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/utils/aperf.c b/utils/aperf.c
index 627fb17..ff09f64 100644
--- a/utils/aperf.c
+++ b/utils/aperf.c
@@ -53,7 +53,9 @@
#include <string.h>
#include "cpufreq.h"
-#include "cpuid.h"
+#if defined(__i386__) || defined(__x86_64__)
+ #include "cpuid.h"
+#endif
#define MSR_IA32_APERF 0x000000E8
#define MSR_IA32_MPERF 0x000000E7
@@ -68,9 +70,13 @@ struct avg_perf_cpu_info
static int cpu_has_effective_freq()
{
- /* largest base level */
+#if defined(__i386__) || defined(__x86_64__)
+ /* largest base level */
if (cpuid_eax(0) < 6)
return 0;
+#else
+ return 0;
+#endif
return cpuid_ecx(6) & 0x1;
}
--
2.16.4