From 2c6ccfcfdde1d4c1cbec86a1355bce09314e9b84 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 3 Jun 2021 16:48:05 +0200 Subject: [PATCH] PATCH [5/10] arm: Extend again arm_feature_set struct to provide more bits include/ 2021-06-11 Andrea Corallo * opcode/arm.h (arm_feature_set): Extend 'core' field. (ARM_CPU_HAS_FEATURE, ARM_FSET_CPU_SUBSET, ARM_CPU_IS_ANY) (ARM_MERGE_FEATURE_SETS, ARM_CLEAR_FEATURE, ARM_FEATURE_EQUAL) (ARM_FEATURE_ZERO, ARM_FEATURE_CORE_EQUAL): Account for 'core[2]'. (ARM_FEATURE_CORE_HIGH_HIGH): New macro. --- include/opcode/arm.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/include/opcode/arm.h b/include/opcode/arm.h index 90c09a70658..1152e781222 100644 --- a/include/opcode/arm.h +++ b/include/opcode/arm.h @@ -427,7 +427,7 @@ and use macro ARM_FEATURE to initialize the feature set variable. */ typedef struct { - unsigned long core[2]; + unsigned long core[3]; unsigned long coproc; } arm_feature_set; @@ -435,23 +435,27 @@ typedef struct #define ARM_CPU_HAS_FEATURE(CPU,FEAT) \ (((CPU).core[0] & (FEAT).core[0]) != 0 \ || ((CPU).core[1] & (FEAT).core[1]) != 0 \ + || ((CPU).core[2] & (FEAT).core[2]) != 0 \ || ((CPU).coproc & (FEAT).coproc) != 0) /* Tests whether the features of A are a subset of B. */ #define ARM_FSET_CPU_SUBSET(A,B) \ (((A).core[0] & (B).core[0]) == (A).core[0] \ && ((A).core[1] & (B).core[1]) == (A).core[1] \ + && ((A).core[2] & (B).core[2]) == (A).core[2] \ && ((A).coproc & (B).coproc) == (A).coproc) #define ARM_CPU_IS_ANY(CPU) \ ((CPU).core[0] == ((arm_feature_set)ARM_ANY).core[0] \ - && (CPU).core[1] == ((arm_feature_set)ARM_ANY).core[1]) + && (CPU).core[1] == ((arm_feature_set)ARM_ANY).core[1] \ + && (CPU).core[2] == ((arm_feature_set)ARM_ANY).core[2]) #define ARM_MERGE_FEATURE_SETS(TARG,F1,F2) \ do \ { \ (TARG).core[0] = (F1).core[0] | (F2).core[0]; \ (TARG).core[1] = (F1).core[1] | (F2).core[1]; \ + (TARG).core[2] = (F1).core[2] | (F2).core[2]; \ (TARG).coproc = (F1).coproc | (F2).coproc; \ } \ while (0) @@ -461,6 +465,7 @@ typedef struct { \ (TARG).core[0] = (F1).core[0] &~ (F2).core[0]; \ (TARG).core[1] = (F1).core[1] &~ (F2).core[1]; \ + (TARG).core[2] = (F1).core[2] &~ (F2).core[2]; \ (TARG).coproc = (F1).coproc &~ (F2).coproc; \ } \ while (0) @@ -468,17 +473,24 @@ typedef struct #define ARM_FEATURE_EQUAL(T1,T2) \ ( (T1).core[0] == (T2).core[0] \ && (T1).core[1] == (T2).core[1] \ + && (T1).core[2] == (T2).core[2] \ && (T1).coproc == (T2).coproc) #define ARM_FEATURE_ZERO(T) \ - ((T).core[0] == 0 && (T).core[1] == 0 && (T).coproc == 0) + ((T).core[0] == 0 \ + && (T).core[1] == 0 \ + && (T).core[2] == 0 \ + && (T).coproc == 0) #define ARM_FEATURE_CORE_EQUAL(T1, T2) \ - ((T1).core[0] == (T2).core[0] && (T1).core[1] == (T2).core[1]) + ((T1).core[0] == (T2).core[0] \ + && (T1).core[1] == (T2).core[1] \ + && (T1).core[2] == (T2).core[2]) #define ARM_FEATURE_LOW(core, coproc) {{(core), 0}, (coproc)} #define ARM_FEATURE_CORE(core1, core2) {{(core1), (core2)}, 0} #define ARM_FEATURE_CORE_LOW(core) {{(core), 0}, 0} #define ARM_FEATURE_CORE_HIGH(core) {{0, (core)}, 0} +#define ARM_FEATURE_CORE_HIGH_HIGH(core) {{0, 0, (core)}, 0} #define ARM_FEATURE_COPROC(coproc) {{0, 0}, (coproc)} #define ARM_FEATURE(core1, core2, coproc) {{(core1), (core2)}, (coproc)} -- 2.30.2