@@ -192,7 +192,11 @@ struct cpu_policy
};
/* Subleaf 2. */
- uint32_t /* a */:32, /* b */:32, /* c */:32;
+ union {
+ uint32_t _7a2;
+ struct { DECL_BITFIELD(7a2); };
+ };
+ uint32_t /* b */:32, /* c */:32;
union {
uint32_t _7d2;
struct { DECL_BITFIELD(7d2); };
@@ -20,8 +20,10 @@
#define FEATURESET_7d2 13 /* 0x00000007:2.edx */
#define FEATURESET_7c1 14 /* 0x00000007:1.ecx */
#define FEATURESET_7d1 15 /* 0x00000007:1.edx */
+#define FEATURESET_7a2 16
#define X86_NR_FEAT (FEATURESET_7d1 + 1)
+//#define X86_NR_FEAT (FEATURESET_7a2 + 1)
#endif /* !XEN_LIB_X86_CONSTS_H */
@@ -79,6 +79,7 @@ void x86_cpu_policy_to_featureset(
fs[FEATURESET_7d2] = p->feat._7d2;
fs[FEATURESET_7c1] = p->feat._7c1;
fs[FEATURESET_7d1] = p->feat._7d1;
+ fs[FEATURESET_7a2] = p->feat._7a2;
}
void x86_cpu_featureset_to_policy(
@@ -100,6 +101,7 @@ void x86_cpu_featureset_to_policy(
p->feat._7d2 = fs[FEATURESET_7d2];
p->feat._7c1 = fs[FEATURESET_7c1];
p->feat._7d1 = fs[FEATURESET_7d1];
+ p->feat._7a2 = fs[FEATURESET_7a2];
}
void x86_cpu_policy_recalc_synth(struct cpu_policy *p)
Prior to disentangling X86_NR_FEAT from FEATURESET_NR_ENTRIES, GCC 12 correctly notices: lib/x86/cpuid.c: In function 'x86_cpu_policy_to_featureset': lib/x86/cpuid.c:82:7: error: array subscript 16 is outside array bounds of 'uint32_t[16]' {aka 'unsigned int[16]'} [-Werror=array-bounds=] 82 | fs[FEATURESET_7a2] = p->feat._7a2; | ~~^~~~~~~~~~~~~~~~ lib/x86/cpuid.c:64:42: note: at offset 64 into object 'fs' of size [0, 64] Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- xen/include/xen/lib/x86/cpu-policy.h | 6 +++++- xen/include/xen/lib/x86/cpuid-consts.h | 2 ++ xen/lib/x86/cpuid.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)