aboutsummaryrefslogtreecommitdiff
path: root/src/x86
diff options
context:
space:
mode:
Diffstat (limited to 'src/x86')
-rw-r--r--src/x86/cache/descriptor.c14
-rw-r--r--src/x86/mockcpuid.c2
-rw-r--r--src/x86/name.c9
-rw-r--r--src/x86/vendor.c2
-rw-r--r--src/x86/windows/init.c19
5 files changed, 26 insertions, 20 deletions
diff --git a/src/x86/cache/descriptor.c b/src/x86/cache/descriptor.c
index 6532e4d..69d38cc 100644
--- a/src/x86/cache/descriptor.c
+++ b/src/x86/cache/descriptor.c
@@ -353,7 +353,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x39:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->l2 = (struct cpuinfo_x86_cache) {
.size = 128 * 1024,
.associativity = 4,
@@ -364,7 +364,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x3A:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->l2 = (struct cpuinfo_x86_cache) {
.size = 192 * 1024,
.associativity = 6,
@@ -375,7 +375,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x3B:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->l2 = (struct cpuinfo_x86_cache) {
.size = 128 * 1024,
.associativity = 2,
@@ -386,7 +386,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x3C:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->l2 = (struct cpuinfo_x86_cache) {
.size = 256 * 1024,
.associativity = 4,
@@ -397,7 +397,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x3D:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->l2 = (struct cpuinfo_x86_cache) {
.size = 384 * 1024,
.associativity = 6,
@@ -408,7 +408,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x3E:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->l2 = (struct cpuinfo_x86_cache) {
.size = 512 * 1024,
.associativity = 4,
@@ -1011,7 +1011,7 @@ void cpuinfo_x86_decode_cache_descriptor(
};
break;
case 0x73:
- /* Where does this come from? */
+ /* Where does this come from? */
cache->trace = (struct cpuinfo_trace_cache) {
.uops = 64 * 1024,
.associativity = 8,
diff --git a/src/x86/mockcpuid.c b/src/x86/mockcpuid.c
index 6361dc2..2631f09 100644
--- a/src/x86/mockcpuid.c
+++ b/src/x86/mockcpuid.c
@@ -14,7 +14,7 @@ static uint32_t cpuinfo_mock_cpuid_leaf4_iteration = 0;
void CPUINFO_ABI cpuinfo_mock_set_cpuid(struct cpuinfo_mock_cpuid* dump, size_t entries) {
cpuinfo_mock_cpuid_data = dump;
- cpuinfo_mock_cpuid_entries = entries;
+ cpuinfo_mock_cpuid_entries = entries;
};
void CPUINFO_ABI cpuinfo_mock_get_cpuid(uint32_t eax, uint32_t regs[4]) {
diff --git a/src/x86/name.c b/src/x86/name.c
index e0d5a5b..a7cc7c6 100644
--- a/src/x86/name.c
+++ b/src/x86/name.c
@@ -135,7 +135,7 @@ static inline bool is_frequency(const char* token_start, const char* token_end)
const size_t token_length = (size_t) (token_end - token_start);
if (token_length > 3 && token_end[-2] == 'H' && token_end[-1] == 'z') {
switch (token_end[-3]) {
- case 'K':
+ case 'K':
case 'M':
case 'G':
return true;
@@ -347,7 +347,7 @@ static bool transform_token(char* token_start, char* token_end, struct parser_st
return false;
}
/*
- * Erase "Mobile" when it is not part of the processor name,
+ * Erase "Mobile" when it is not part of the processor name,
* e.g. in "AMD Turion(tm) X2 Ultra Dual-Core Mobile ZM-82"
*/
if (previousState.context_core != NULL) {
@@ -540,8 +540,7 @@ uint32_t cpuinfo_x86_normalize_brand_string(
char* name_end = &name[48];
while (name_end[-1] == '\0') {
/*
- * Adject name_end by 1 position and
- * check that we didn't reach the start of the brand string.
+ * Adject name_end by 1 position and check that we didn't reach the start of the brand string.
* This is possible if all characters are zero.
*/
if (--name_end == name) {
@@ -704,6 +703,6 @@ uint32_t cpuinfo_x86_format_package_name(
} else {
snprintf(package_name, CPUINFO_PACKAGE_NAME_MAX,
"%s %s", vendor_string, normalized_brand_string);
- return strlen(vendor_string) + 1;
+ return (uint32_t) strlen(vendor_string) + 1;
}
}
diff --git a/src/x86/vendor.c b/src/x86/vendor.c
index 2bba90d..bad50fa 100644
--- a/src/x86/vendor.c
+++ b/src/x86/vendor.c
@@ -79,7 +79,7 @@ enum cpuinfo_vendor cpuinfo_x86_decode_vendor(uint32_t ebx, uint32_t ecx, uint32
case ineI:
if (ecx == ntel) {
/* "GenuineIntel" */
- return cpuinfo_vendor_intel;
+ return cpuinfo_vendor_intel;
}
break;
#if CPUINFO_ARCH_X86
diff --git a/src/x86/windows/init.c b/src/x86/windows/init.c
index 2c7e3cd..9a23bd7 100644
--- a/src/x86/windows/init.c
+++ b/src/x86/windows/init.c
@@ -8,7 +8,14 @@
#include <cpuinfo/internal-api.h>
#include <cpuinfo/log.h>
-#include <Windows.h>
+#include <windows.h>
+
+#ifdef __GNUC__
+ #define CPUINFO_ALLOCA __builtin_alloca
+#else
+ #define CPUINFO_ALLOCA _alloca
+#endif
+
static inline uint32_t bit_mask(uint32_t bits) {
return (UINT32_C(1) << bits) - UINT32_C(1);
@@ -118,7 +125,7 @@ BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PV
cpuinfo_log_debug("detected %"PRIu32" processor groups", max_group_count);
uint32_t processors_count = 0;
- uint32_t* processors_per_group = (uint32_t*) _alloca(max_group_count * sizeof(uint32_t));
+ uint32_t* processors_per_group = (uint32_t*) CPUINFO_ALLOCA(max_group_count * sizeof(uint32_t));
for (uint32_t i = 0; i < max_group_count; i++) {
processors_per_group[i] = GetMaximumProcessorCount((WORD) i);
cpuinfo_log_debug("detected %"PRIu32" processors in group %"PRIu32,
@@ -126,7 +133,7 @@ BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PV
processors_count += processors_per_group[i];
}
- uint32_t* processors_before_group = (uint32_t*) _alloca(max_group_count * sizeof(uint32_t));
+ uint32_t* processors_before_group = (uint32_t*) CPUINFO_ALLOCA(max_group_count * sizeof(uint32_t));
for (uint32_t i = 0, count = 0; i < max_group_count; i++) {
processors_before_group[i] = count;
cpuinfo_log_debug("detected %"PRIu32" processors before group %"PRIu32,
@@ -196,7 +203,7 @@ BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PV
/* Iterate processor groups and set the package part of APIC ID */
for (uint32_t i = 0; i < package_info->Processor.GroupCount; i++) {
const uint32_t group_id = package_info->Processor.GroupMask[i].Group;
- /* Global index of the first logical processor belonging to this group */
+ /* Global index of the first logical processor belonging to this group */
const uint32_t group_processors_start = processors_before_group[group_id];
/* Bitmask representing processors in this group belonging to this package */
KAFFINITY group_processors_mask = package_info->Processor.GroupMask[i].Mask;
@@ -245,7 +252,7 @@ BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PV
/* Iterate processor groups and set the core & SMT parts of APIC ID */
for (uint32_t i = 0; i < core_info->Processor.GroupCount; i++) {
const uint32_t group_id = core_info->Processor.GroupMask[i].Group;
- /* Global index of the first logical processor belonging to this group */
+ /* Global index of the first logical processor belonging to this group */
const uint32_t group_processors_start = processors_before_group[group_id];
/* Bitmask representing processors in this group belonging to this package */
KAFFINITY group_processors_mask = core_info->Processor.GroupMask[i].Mask;
@@ -259,7 +266,7 @@ BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PV
current_package_apic_id = processors[processor_id].apic_id;
}
/* Core ID w.r.t package */
- const uint32_t package_core_id = core_id - package_core_start;
+ const uint32_t package_core_id = core_id - package_core_start;
/* Update APIC ID with core and SMT parts */
processors[processor_id].apic_id |=