[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 6/6] DO NOT APPLY: Example breakage
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@xxxxxxxxxx> --- 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(-) diff --git a/xen/include/xen/lib/x86/cpu-policy.h b/xen/include/xen/lib/x86/cpu-policy.h index 01431de056c8..164b3f4aac13 100644 --- a/xen/include/xen/lib/x86/cpu-policy.h +++ b/xen/include/xen/lib/x86/cpu-policy.h @@ -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); }; diff --git a/xen/include/xen/lib/x86/cpuid-consts.h b/xen/include/xen/lib/x86/cpuid-consts.h index 9fe931b8e31f..5dd9727fec79 100644 --- a/xen/include/xen/lib/x86/cpuid-consts.h +++ b/xen/include/xen/lib/x86/cpuid-consts.h @@ -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 */ diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c index 76f26e92af8d..90bc82a18c30 100644 --- a/xen/lib/x86/cpuid.c +++ b/xen/lib/x86/cpuid.c @@ -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) -- 2.30.2
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |