[v0.98][PPC] Various fixes. Implement debug option

This commit is contained in:
Dr-Noob
2021-07-31 23:46:29 +02:00
parent 55df725e38
commit aa7eaa882f
5 changed files with 14 additions and 12 deletions

View File

@@ -125,6 +125,8 @@ struct cpuInfo {
uint32_t maxExtendedLevels;
// Topology Extensions (AMD only)
bool topology_extensions;
#elif ARCH_PPC
uint32_t pvr;
#elif ARCH_ARM
// Main ID register
uint32_t midr;

View File

@@ -539,7 +539,6 @@ void print_ascii_ppc(struct ascii* art, uint32_t la) {
uint32_t space_right;
uint32_t space_up = (NUMBER_OF_LINES - art->n_attributes_set)/2;
uint32_t space_down = NUMBER_OF_LINES - art->n_attributes_set - space_up;
bool flag = false;
printf("\n");
for(uint32_t n=0;n<NUMBER_OF_LINES;n++) {
@@ -573,8 +572,8 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct colors* cs) {
char* manufacturing_process = get_str_process(cpu);
char* sockets = get_str_sockets(cpu->topo);
char* max_frequency = get_str_freq(cpu->freq);
char* n_cores = get_str_topology(cpu, cpu->topo, false);
char* n_cores_dual = get_str_topology(cpu, cpu->topo, true);
char* n_cores = get_str_topology(cpu->topo, false);
char* n_cores_dual = get_str_topology(cpu->topo, true);
char* altivec = get_str_altivec(cpu);
char* l1i = get_str_l1i(cpu->cach);

View File

@@ -35,5 +35,6 @@ long get_l1i_cache_size(uint32_t core);
long get_l1d_cache_size(uint32_t core);
long get_l2_cache_size(uint32_t core);
long get_l3_cache_size(uint32_t core);
int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level);
#endif

View File

@@ -73,7 +73,7 @@ struct cache* get_cache_info(struct cpuInfo* cpu) {
return cach;
}
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach) {
struct topology* get_topology_info(struct cache* cach) {
struct topology* topo = malloc(sizeof(struct topology));
init_topology_struct(topo, cach);
@@ -142,9 +142,8 @@ static inline uint32_t mfpvr() {
return pvr;
}
struct uarch* get_cpu_uarch() {
uint32_t pvr = mfpvr();
return get_uarch_from_pvr(pvr);
struct uarch* get_cpu_uarch(struct cpuInfo* cpu) {
return get_uarch_from_pvr(cpu->pvr);
}
struct frequency* get_frequency_info() {
@@ -166,9 +165,10 @@ struct cpuInfo* get_cpu_info() {
*ptr = false;
}
cpu->arch = get_cpu_uarch();
cpu->pvr = mfpvr();
cpu->arch = get_cpu_uarch(cpu);
cpu->freq = get_frequency_info();
cpu->topo = get_topology_info(cpu, cpu->cach);
cpu->topo = get_topology_info(cpu->cach);
cpu->cach = get_cache_info(cpu);
feat->altivec = has_altivec(cpu->arch);
@@ -219,7 +219,7 @@ char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64
return string;
}
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_socket) {
char* get_str_topology(struct topology* topo, bool dual_socket) {
char* string;
if(topo->smt_supported > 1) {
uint32_t size = 3+3+17+1;
@@ -242,5 +242,5 @@ char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_soc
void print_debug(struct cpuInfo* cpu) {
printf("TODO\n");
printf("PVR: 0x%.8X\n", cpu->pvr);
}

View File

@@ -3,9 +3,9 @@
#include "../common/cpu.h"
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach);
struct cpuInfo* get_cpu_info();
char* get_str_altivec(struct cpuInfo* cpu);
char* get_str_topology(struct topology* topo, bool dual_socket);
char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64_t freq);
void print_debug(struct cpuInfo* cpu);