[v0.91][ARM] Print manufacturing process from SoC information

This commit is contained in:
Dr-Noob
2020-11-26 10:51:44 +01:00
parent 20dbc3be27
commit 4c36e4c5e5
6 changed files with 19 additions and 9 deletions

View File

@@ -310,6 +310,7 @@ struct system_on_chip* get_soc() {
struct system_on_chip* soc = malloc(sizeof(struct system_on_chip)); struct system_on_chip* soc = malloc(sizeof(struct system_on_chip));
soc->raw_name = NULL; soc->raw_name = NULL;
soc->soc_vendor = SOC_UNKNOWN; soc->soc_vendor = SOC_UNKNOWN;
soc->process = UNKNOWN;
soc = guess_soc_from_cpuinfo(soc); soc = guess_soc_from_cpuinfo(soc);
if(soc->soc_vendor == SOC_UNKNOWN) { if(soc->soc_vendor == SOC_UNKNOWN) {
@@ -340,3 +341,18 @@ char* get_soc_name(struct system_on_chip* soc) {
return soc->soc_name; return soc->soc_name;
} }
char* get_str_process(struct system_on_chip* soc) {
char* str;
if(soc->process == UNKNOWN) {
str = malloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
}
else {
str = malloc(sizeof(char) * 5);
memset(str, 0, sizeof(char) * 5);
snprintf(str, 5, "%dnm", soc->process);
}
return str;
}

View File

@@ -21,5 +21,6 @@ struct system_on_chip {
struct system_on_chip* get_soc(); struct system_on_chip* get_soc();
char* get_soc_name(struct system_on_chip* soc); char* get_soc_name(struct system_on_chip* soc);
char* get_str_process(struct system_on_chip* soc);
#endif #endif

View File

@@ -275,12 +275,6 @@ char* get_str_uarch(struct cpuInfo* cpu) {
return cpu->arch->uarch_str; return cpu->arch->uarch_str;
} }
char* get_str_process(struct cpuInfo* cpu) {
char* str = malloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
return str;
}
void free_uarch_struct(struct uarch* arch) { void free_uarch_struct(struct uarch* arch) {
free(arch->uarch_str); free(arch->uarch_str);
free(arch); free(arch);

View File

@@ -7,7 +7,6 @@
struct uarch* get_uarch_from_midr(uint32_t midr, struct cpuInfo* cpu); struct uarch* get_uarch_from_midr(uint32_t midr, struct cpuInfo* cpu);
char* get_str_uarch(struct cpuInfo* cpu); char* get_str_uarch(struct cpuInfo* cpu);
char* get_str_process(struct cpuInfo* cpu);
void free_uarch_struct(struct uarch* arch); void free_uarch_struct(struct uarch* arch);
#endif #endif

View File

@@ -13,7 +13,7 @@
#include "../arm/midr.h" #include "../arm/midr.h"
#endif #endif
static const char* VERSION = "0.90"; static const char* VERSION = "0.91";
void print_help(char *argv[]) { void print_help(char *argv[]) {
printf("Usage: %s [--version] [--help] [--debug] [--style \"fancy\"|\"retro\"|\"legacy\"] [--color \"intel\"|\"amd\"|'R,G,B:R,G,B:R,G,B:R,G,B']\n\n", argv[0]); printf("Usage: %s [--version] [--help] [--debug] [--style \"fancy\"|\"retro\"|\"legacy\"] [--color \"intel\"|\"amd\"|'R,G,B:R,G,B:R,G,B:R,G,B']\n\n", argv[0]);

View File

@@ -542,7 +542,7 @@ void print_ascii(struct ascii* art) {
} }
bool print_cpufetch_arm(struct ascii* art, struct cpuInfo* cpu, struct colors* cs) { bool print_cpufetch_arm(struct ascii* art, struct cpuInfo* cpu, struct colors* cs) {
char* manufacturing_process = get_str_process(cpu); char* manufacturing_process = get_str_process(cpu->soc);
char* soc_name = get_soc_name(cpu->soc); char* soc_name = get_soc_name(cpu->soc);
setAttribute(art,ATTRIBUTE_SOC,soc_name); setAttribute(art,ATTRIBUTE_SOC,soc_name);
setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process); setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process);