[v0.8][Refactoring] Refactoring ARM code and source code tree

This commit is contained in:
Dr-Noob
2020-11-05 11:01:46 +01:00
parent 1fad4fd10b
commit f4f68287aa
14 changed files with 109 additions and 67 deletions

View File

@@ -4,23 +4,18 @@
#include <assert.h>
#include <stdbool.h>
#include "cpuid.h"
#include "midr.h"
struct frequency {
int64_t base;
int64_t max;
};
struct cpuInfo* get_cpu_info() {
struct cpuInfo* get_cpu_info() {
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
cpu->cpu_vendor = CPU_VENDOR_UNKNOWN;
cpu->cpu_name = malloc(sizeof(char) * CPU_NAME_MAX_LENGTH);
strcpy(cpu->cpu_name, "Unknown");
cpu->arch = NULL;
cpu->hv = malloc(sizeof(struct hypervisor));
cpu->hv->present = false;
return cpu;
}

View File

@@ -1,5 +1,5 @@
#ifndef __CPUID__
#define __CPUID__
#ifndef __MIDR__
#define __MIDR__
#include "../common/cpu.h"

View File

@@ -7,9 +7,6 @@
#include "../common/global.h"
struct uarch* get_uarch_from_cpuid(struct cpuInfo* cpu, uint32_t ef, uint32_t f, uint32_t em, uint32_t m, int s) { return NULL; }
bool vpus_are_AVX512(struct cpuInfo* cpu) { return false; }
bool is_knights_landing(struct cpuInfo* cpu) { return false; }
int get_number_of_vpus(struct cpuInfo* cpu) { return 0; }
char* get_str_uarch(struct cpuInfo* cpu) { char* tmp = malloc(sizeof(char) * 10); strcpy(tmp, "Unknown"); return tmp; }
char* get_str_process(struct cpuInfo* cpu) { char* tmp = malloc(sizeof(char) * 10); strcpy(tmp, "Unknown"); return tmp; }
void free_uarch_struct(struct uarch* arch) { }

View File

@@ -3,14 +3,11 @@
#include <stdint.h>
#include "cpuid.h"
#include "midr.h"
struct uarch;
struct uarch* get_uarch_from_cpuid(struct cpuInfo* cpu, uint32_t ef, uint32_t f, uint32_t em, uint32_t m, int s);
bool vpus_are_AVX512(struct cpuInfo* cpu);
bool is_knights_landing(struct cpuInfo* cpu);
int get_number_of_vpus(struct cpuInfo* cpu);
char* get_str_uarch(struct cpuInfo* cpu);
char* get_str_process(struct cpuInfo* cpu);
void free_uarch_struct(struct uarch* arch);