Skip to content

Commit

Permalink
Fix build error for MinGW aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 authored May 22, 2024
1 parent 3c8b153 commit c832e42
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/arm/windows/init-by-logical-sys-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,22 @@ static bool parse_relation_cache_info(
struct cpuinfo_cache* l2_base = l1d_base + numbers_of_caches[cpuinfo_cache_level_1d];
struct cpuinfo_cache* l3_base = l2_base + numbers_of_caches[cpuinfo_cache_level_2];

#ifdef __MINGW32__
cpuinfo_log_debug(
"info->Cache.GroupMask:%" PRIu32
","
"info->Cache.Level:%" PRIu32 ", info->Cache.Associativity:%" PRIu32
","
"info->Cache.LineSize:%" PRIu32
","
"info->Cache.CacheSize:%" PRIu32 ", info->Cache.Type:%" PRIu32 "",
(unsigned int)info->Cache.GroupMask.Mask,
info->Cache.Level,
info->Cache.Associativity,
info->Cache.LineSize,
info->Cache.CacheSize,
info->Cache.Type);
#else
cpuinfo_log_debug(
"info->Cache.GroupCount:%" PRIu32 ", info->Cache.GroupMask:%" PRIu32
","
Expand Down Expand Up @@ -701,6 +717,18 @@ static bool parse_relation_cache_info(
current_cache->flags = CPUINFO_CACHE_UNIFIED;
}

#ifdef __MINGW32__
const uint32_t group_id = info->Cache.GroupMask.Group;
KAFFINITY group_processors_mask = info->Cache.GroupMask.Mask;
while (group_processors_mask != 0) {
const uint32_t processor_id_in_group = low_index_from_kaffinity(group_processors_mask);
const uint32_t processor_global_index = global_proc_index_per_group[group_id] + processor_id_in_group;

store_cache_info_per_processor(processors, processor_global_index, info, current_cache);

group_processors_mask &= ~(1 << processor_id_in_group);
}
#else
for (uint32_t i = 0; i < info->Cache.GroupCount; i++) {
/* Zero GroupCount is valid, GroupMask still can store bits set.
*/
Expand All @@ -721,6 +749,7 @@ static bool parse_relation_cache_info(
group_processors_mask &= (group_processors_mask - 1);
}
}
#endif
return true;
}

Expand Down

0 comments on commit c832e42

Please sign in to comment.