summaryrefslogtreecommitdiff
path: root/cpu_features.c
diff options
context:
space:
mode:
authorVladislav Shchapov <vladislav@shchapov.ru>2023-02-18 21:25:55 +0500
committerHans Kristian Rosbach <hk-github@circlestorm.org>2023-03-06 13:26:09 +0100
commit20d8fa8af137e5efb4ec79b25caf2de0ed68b5c7 (patch)
tree29ab0304f6eee8c11deb6acc97eb5a1d5b5f7ecb /cpu_features.c
parentc5b4aa34fe4c8e6690f7935ad27dacbdd5cc821d (diff)
downloadProject-Tick-20d8fa8af137e5efb4ec79b25caf2de0ed68b5c7.tar.gz
Project-Tick-20d8fa8af137e5efb4ec79b25caf2de0ed68b5c7.zip
Replace global CPU feature flag variables with local variable in init_functable
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Diffstat (limited to 'cpu_features.c')
-rw-r--r--cpu_features.c17
1 files changed, 7 insertions, 10 deletions
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 <string.h>
-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;
}