[v1.05][X86] Do not stop if cach is NULL and check for non-NULL cache in get_topology_info functions

This commit is contained in:
Dr-Noob
2024-02-18 18:24:30 +00:00
parent 262049dee2
commit 31fc312337
2 changed files with 10 additions and 4 deletions

View File

@@ -369,6 +369,11 @@ bool fill_apic_ids(uint32_t* apic_ids, int first_core, int n, bool x2apic_id) {
}
bool get_topology_from_apic(struct cpuInfo* cpu, struct topology* topo) {
if (topo->cach == NULL) {
printWarn("get_topology_from_apic: cach is NULL");
return false;
}
uint32_t apic_id;
uint32_t* apic_ids = emalloc(sizeof(uint32_t) * topo->total_cores_module);
uint32_t* apic_pkg = emalloc(sizeof(uint32_t) * topo->total_cores_module);

View File

@@ -549,11 +549,7 @@ struct cpuInfo* get_cpu_info(void) {
cpu->cpu_name = infer_cpu_name_from_uarch(cpu->arch);
}
// If cach is NULL continue,
// as get_topology_info
// requires non-NULL cache
ptr->cach = get_cache_info(ptr);
if(ptr->cach == NULL) continue;
if(cpu->hybrid_flag) {
ptr->topo = get_topology_info(ptr, ptr->cach, i);
@@ -573,6 +569,11 @@ struct cpuInfo* get_cpu_info(void) {
}
bool get_cache_topology_amd(struct cpuInfo* cpu, struct topology* topo) {
if (topo->cach == NULL) {
printWarn("get_cache_topology_amd: cach is NULL");
return false;
}
if(cpu->maxExtendedLevels >= 0x8000001D && cpu->topology_extensions) {
uint32_t i, eax, ebx, ecx, edx, num_sharing_cache, cache_type, cache_level;