[v1.03][RISCV] Add preeliminary uarch detection

This commit is contained in:
Dr-Noob
2023-04-07 16:19:43 +02:00
parent 69dd47bab0
commit 13e86d7f14
6 changed files with 88 additions and 7 deletions

View File

@@ -5,6 +5,8 @@
#include "../common/global.h"
#include "../common/udev.h"
#include "udev.h"
#include "uarch.h"
#include "soc.h"
struct frequency* get_frequency_info(uint32_t core) {
@@ -34,8 +36,10 @@ struct cpuInfo* get_cpu_info(void) {
topo->cach = NULL;
cpu->topo = topo;
char* cpuinfo_str = get_uarch_from_cpuinfo();
cpu->hv = emalloc(sizeof(struct hypervisor));
cpu->hv->present = false;
cpu->arch = get_uarch_from_cpuinfo_str(cpuinfo_str, cpu);
cpu->soc = get_soc();
cpu->freq = get_frequency_info(0);
cpu->peak_performance = get_peak_performance(cpu);
@@ -46,7 +50,7 @@ struct cpuInfo* get_cpu_info(void) {
//TODO: Might be worth refactoring with other archs
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo) {
uint32_t size = 3+7+1;
char* string = emalloc(sizeof(char)*size);
char* string = emalloc(sizeof(char)*size);
snprintf(string, size, "%d cores", topo->total_cores);
return string;