From fc829628d9bc1dbcb842afecf7a683cdf64bd274 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Fri, 8 Mar 2024 19:40:54 +0300 Subject: [PATCH] cpuid_vendor_id.mod.c: use only tabs for scope indentation --- c-programming/sys/cpuid_vendor_id.mod.c | 46 ++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/c-programming/sys/cpuid_vendor_id.mod.c b/c-programming/sys/cpuid_vendor_id.mod.c index 9f9851d..953c3a3 100644 --- a/c-programming/sys/cpuid_vendor_id.mod.c +++ b/c-programming/sys/cpuid_vendor_id.mod.c @@ -39,19 +39,19 @@ typedef unsigned int cpuid_t[4]; // https://stackoverflow.com/questions/1666093/cpuid-implementations-in-c static inline void native_cpuid(unsigned int function_id, cpuid_t r) { #ifdef _WIN32 - __cpuid((int *) r, (int) function_id); + __cpuid((int *) r, (int) function_id); #else - r[EAX] = function_id; - r[ECX] = 0; + r[EAX] = function_id; + r[ECX] = 0; - // NOTE:XXX: Register ECX is often an input as well as an output - asm volatile("cpuid" - : "=a" (r[EAX]), - "=b" (r[EBX]), - "=c" (r[ECX]), - "=d" (r[EDX]) - : "0" (r[EAX]), "2" (r[ECX]) - : "memory"); + // NOTE:XXX: Register ECX is often an input as well as an output + asm volatile("cpuid" + : "=a" (r[EAX]), + "=b" (r[EBX]), + "=c" (r[ECX]), + "=d" (r[EDX]) + : "0" (r[EAX]), "2" (r[ECX]) + : "memory"); #endif } @@ -62,21 +62,21 @@ static inline void native_cpuid(unsigned int function_id, cpuid_t r) { * VENDOR_ID_LEN */ static inline void cpuid_vendor_id(char vendor[VENDOR_ID_LEN]) { - // Always initialize the result in case of buggy CPU (like ES/QS CPUs) - cpuid_t v; - native_cpuid(0, v); + // Always initialize the result in case of buggy CPU (like ES/QS CPUs) + cpuid_t v; + native_cpuid(0, v); - // https://learn.microsoft.com/en-us/cpp/intrinsics/cpuid-cpuidex + // https://learn.microsoft.com/en-us/cpp/intrinsics/cpuid-cpuidex // ?view=msvc-170#example - ((unsigned int *) vendor)[0] = v[EBX]; - ((unsigned int *) vendor)[1] = v[EDX]; - ((unsigned int *) vendor)[2] = v[ECX]; - vendor[VENDOR_ID_LEN - 1] = '\0'; + ((unsigned int *) vendor)[0] = v[EBX]; + ((unsigned int *) vendor)[1] = v[EDX]; + ((unsigned int *) vendor)[2] = v[ECX]; + vendor[VENDOR_ID_LEN - 1] = '\0'; } int main(void) { - char vendor_string[VENDOR_ID_LEN]; - cpuid_vendor_id(vendor_string); - printf("CPU Vendor ID: '%s'\n", vendor_string); - return 0; + char vendor_string[VENDOR_ID_LEN]; + cpuid_vendor_id(vendor_string); + printf("CPU Vendor ID: '%s'\n", vendor_string); + return 0; }