[X86] Avoid checking /sys directory in macOS to find frequency

This commit is contained in:
Dr-Noob
2021-01-10 09:01:50 +01:00
parent 3b624f3025
commit 697a921042
2 changed files with 5 additions and 1 deletions

View File

@@ -286,7 +286,7 @@ void add_apic_to_array(uint32_t apic, uint32_t* apic_ids, int n) {
bool fill_apic_ids(uint32_t* apic_ids, int n, bool x2apic_id) { bool fill_apic_ids(uint32_t* apic_ids, int n, bool x2apic_id) {
#ifdef __APPLE__ #ifdef __APPLE__
// macOS extremely dirty approach... // macOS extremely dirty approach...
printf("cpufetch is computing APIC IDs, please wait..."); printf("cpufetch is computing APIC IDs, please wait...\n");
bool end = false; bool end = false;
uint32_t apic; uint32_t apic;
for(int i=0; i < n; i++) apic_ids[i] = (uint32_t) -1; for(int i=0; i < n; i++) apic_ids[i] = (uint32_t) -1;

View File

@@ -668,6 +668,10 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu) {
} }
freq->base = UNKNOWN_FREQ; freq->base = UNKNOWN_FREQ;
freq->max = UNKNOWN_FREQ; freq->max = UNKNOWN_FREQ;
#elif defined __APPLE__
printErr("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X)", 0x00000016, cpu->maxLevels);
freq->base = UNKNOWN_FREQ;
freq->max = UNKNOWN_FREQ;
#else #else
printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X). Using udev", 0x00000016, cpu->maxLevels); printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X). Using udev", 0x00000016, cpu->maxLevels);
freq->base = UNKNOWN_FREQ; freq->base = UNKNOWN_FREQ;