[v1.03][RISCV] Add support for compiling to RISC-V

This commit is contained in:
Dr-Noob
2023-03-31 17:57:01 +02:00
parent cf77360d1b
commit 1f450b23a1
9 changed files with 67 additions and 1 deletions

View File

@@ -14,6 +14,8 @@
#include "../ppc/uarch.h"
#elif ARCH_ARM
#include "../arm/uarch.h"
#elif ARCH_RISCV
#include "../riscv/uarch.h"
#endif
#define STRING_YES "Yes"

View File

@@ -29,6 +29,9 @@
#elif ARCH_ARM
static const char* ARCH_STR = "ARM build";
#include "../arm/midr.h"
#elif ARCH_RISCV
static const char* ARCH_STR = "RISC-V build";
#include "../riscv/riscv.h"
#endif
#ifdef __linux__

View File

@@ -16,10 +16,12 @@
#elif ARCH_PPC
#include "../ppc/uarch.h"
#include "../ppc/ppc.h"
#else
#elif ARCH_ARM
#include "../arm/uarch.h"
#include "../arm/midr.h"
#include "../arm/soc.h"
#elif ARCH_RISCV
#include "../riscv/riscv.h"
#endif
#ifdef _WIN32
@@ -911,6 +913,13 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
}
#endif
#ifdef ARCH_RISCV
bool print_cpufetch_riscv(struct cpuInfo* cpu, STYLE s, struct color** cs, struct terminal* term) {
printf("Unimplemented\n");
return true;
}
#endif
struct terminal* get_terminal_size(void) {
struct terminal* term = emalloc(sizeof(struct terminal));
@@ -948,5 +957,7 @@ bool print_cpufetch(struct cpuInfo* cpu, STYLE s, struct color** cs, bool show_f
return print_cpufetch_ppc(cpu, s, cs, term, show_full_cpu_name);
#elif ARCH_ARM
return print_cpufetch_arm(cpu, s, cs, term);
#elif ARCH_RISCV
return print_cpufetch_riscv(cpu, s, cs, term);
#endif
}

View File

@@ -11,6 +11,8 @@ typedef int STYLE;
#include "../ppc/ppc.h"
#elif ARCH_ARM
#include "../arm/midr.h"
#elif ARCH_RISCV
#include "../riscv/riscv.h"
#endif
// +-----------------------------------+-----------------------+

12
src/riscv/riscv.c Normal file
View File

@@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
struct cpuInfo* get_cpu_info(void) {
return NULL;
}
void print_debug(struct cpuInfo* cpu) {
printf("Unimplemented!\n");
}

9
src/riscv/riscv.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef __RISCV__
#define __RISCV__
#include "../common/cpu.h"
struct cpuInfo* get_cpu_info(void);
void print_debug(struct cpuInfo* cpu);
#endif

11
src/riscv/uarch.c Normal file
View File

@@ -0,0 +1,11 @@
#include <stdint.h>
struct uarch {
//MICROARCH uarch;
char* uarch_str;
int32_t process; // measured in nanometers
};
void free_uarch_struct(struct uarch* arch) {
}

11
src/riscv/uarch.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef __UARCH__
#define __UARCH__
#include <stdint.h>
#include "riscv.h"
struct uarch;
void free_uarch_struct(struct uarch* arch);
#endif