[v0.88][ARM][BUGFIX] Fix some compilation issues

This commit is contained in:
Dr-Noob
2020-11-23 18:45:42 +01:00
parent eaa86522a4
commit bb05a4d577
5 changed files with 30 additions and 15 deletions

View File

@@ -128,13 +128,14 @@ struct cpuInfo* get_cpu_info() {
cpu->next_cpu = NULL;
int ncores = get_ncores_from_cpuinfo();
bool success = false;
uint32_t* midr_array = malloc(sizeof(uint32_t) * ncores);
uint32_t* ids_array = malloc(sizeof(uint32_t) * ncores);
for(int i=0; i < ncores; i++) {
midr_array[i] = get_midr_from_cpuinfo(i);
midr_array[i] = get_midr_from_cpuinfo(i, &success);
if(midr_array[i] == UNKNOWN) {
if(!success) {
printWarn("Unable to fetch MIDR for core %d. This is probably because the core is offline", i);
midr_array[i] = midr_array[0];
}
@@ -217,14 +218,15 @@ char* get_soc_name(struct cpuInfo* cpu) {
void print_debug(struct cpuInfo* cpu) {
int ncores = get_ncores_from_cpuinfo();
bool success = false;
for(int i=0; i < ncores; i++) {
printf("[Core %d] ", i);
long freq = get_max_freq_from_file(i);
uint32_t midr = get_midr_from_cpuinfo(i);
if(midr == UNKNOWN) {
uint32_t midr = get_midr_from_cpuinfo(i, &success);
if(!success) {
printWarn("Unable to fetch MIDR for core %d. This is probably because the core is offline", i);
printf("0x%.8X ", get_midr_from_cpuinfo(0));
printf("0x%.8X ", get_midr_from_cpuinfo(0, &success));
}
else {
printf("0x%.8X ", midr);

View File

@@ -7,6 +7,8 @@
#include "uarch.h"
#include "../common/global.h"
#define STRING_UNKNOWN "Unknown"
// Data not available
#define NA -1
@@ -276,8 +278,8 @@ char* get_str_uarch(struct cpuInfo* cpu) {
}
char* get_str_process(struct cpuInfo* cpu) {
char* str = malloc(sizeof(char) * (4+2+1));
sprintf(str, "%s", "Unknown");
char* str = malloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
return str;
}