From c4f6ba7c5528e1e5ae40f1e1065b8a45254ea704 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Wed, 4 Aug 2021 23:33:20 +0200 Subject: [PATCH] [v0.98] Fix compilation in different platforms --- src/arm/udev.c | 1 + src/common/global.h | 1 + src/x86/cpuid.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/arm/udev.c b/src/arm/udev.c index 02d782b..873edca 100644 --- a/src/arm/udev.c +++ b/src/arm/udev.c @@ -1,3 +1,4 @@ +#include "../common/global.h" #include "udev.h" #include "midr.h" diff --git a/src/common/global.h b/src/common/global.h index 5e090f0..92afce2 100644 --- a/src/common/global.h +++ b/src/common/global.h @@ -2,6 +2,7 @@ #define __GLOBAL__ #include +#include void set_log_level(bool verbose); void printWarn(const char *fmt, ...); diff --git a/src/x86/cpuid.c b/src/x86/cpuid.c index e01e9f8..6c307d8 100644 --- a/src/x86/cpuid.c +++ b/src/x86/cpuid.c @@ -671,13 +671,16 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu) { freq->base = UNKNOWN_FREQ; } if(freq->max == 0) { - printWarn("Read max CPU frequency from CPUID and got 0 MHz. Using udev"); - freq->max = get_max_freq_from_file(0, cpu->hv->present); + printWarn("Read max CPU frequency from CPUID and got 0 MHz"); + #ifdef __linux__ + printWarn("Using udev to detect frequency"); + freq->max = get_max_freq_from_file(0, cpu->hv->present); - if(freq->max == 0) { - printWarn("Read max CPU frequency from udev and got 0 MHz"); - freq->max = UNKNOWN_FREQ; - } + if(freq->max == 0) { + printWarn("Read max CPU frequency from udev and got 0 MHz"); + freq->max = UNKNOWN_FREQ; + } + #endif } }