Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error for MinGW aarch64 #244

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 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 All @@ -659,6 +675,7 @@ static bool parse_relation_cache_info(
info->Cache.LineSize,
info->Cache.CacheSize,
info->Cache.Type);
#endif

struct cpuinfo_cache* current_cache = NULL;
switch (info->Cache.Level) {
Expand Down Expand Up @@ -701,6 +718,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 +750,7 @@ static bool parse_relation_cache_info(
group_processors_mask &= (group_processors_mask - 1);
}
}
#endif
return true;
}

Expand Down