From 20d8fa8af137e5efb4ec79b25caf2de0ed68b5c7 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Sat, 18 Feb 2023 21:25:55 +0500 Subject: Replace global CPU feature flag variables with local variable in init_functable Signed-off-by: Vladislav Shchapov --- cpu_features.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'cpu_features.c') diff --git a/cpu_features.c b/cpu_features.c index b5e7257696..b69a01304a 100644 --- a/cpu_features.c +++ b/cpu_features.c @@ -4,21 +4,18 @@ */ #include "zbuild.h" - #include "cpu_features.h" +#include -Z_INTERNAL void cpu_check_features(void) { - static int features_checked = 0; - if (features_checked) - return; +Z_INTERNAL void cpu_check_features(struct cpu_features *features) { + memset(features, 0, sizeof(struct cpu_features)); #if defined(X86_FEATURES) - x86_check_features(); + x86_check_features(&features->x86); #elif defined(ARM_FEATURES) - arm_check_features(); + arm_check_features(&features->arm); #elif defined(PPC_FEATURES) || defined(POWER_FEATURES) - power_check_features(); + power_check_features(&features->power); #elif defined(S390_FEATURES) - PREFIX(s390_check_features)(); + s390_check_features(&features->s390); #endif - features_checked = 1; } -- cgit 0.0.5-2-1-g0f52