* [PATCH] x86: fix build with old gcc after CPU policy changes
@ 2023-04-18 10:15 Jan Beulich
2023-04-18 10:17 ` Andrew Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2023-04-18 10:15 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné
Old gcc won't cope with initializers involving unnamed struct/union
fields.
Fixes: 441b1b2a50ea ("x86/emul: Switch x86_emulate_ctxt to cpu_policy")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
+++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
@@ -893,12 +893,14 @@ int LLVMFuzzerTestOneInput(const uint8_t
struct x86_emulate_ctxt ctxt = {
.data = &state,
.regs = &input.regs,
- .cpu_policy = &cp,
.addr_size = 8 * sizeof(void *),
.sp_size = 8 * sizeof(void *),
};
int rc;
+ /* Not part of the initializer, for old gcc to cope. */
+ ctxt.cpu_policy = &cp;
+
/* Reset all global state variables */
memset(&input, 0, sizeof(input));
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1313,12 +1313,14 @@ int pv_emulate_privileged_op(struct cpu_
struct domain *currd = curr->domain;
struct priv_op_ctxt ctxt = {
.ctxt.regs = regs,
- .ctxt.cpu_policy = currd->arch.cpu_policy,
.ctxt.lma = !is_pv_32bit_domain(currd),
};
int rc;
unsigned int eflags, ar;
+ /* Not part of the initializer, for old gcc to cope. */
+ ctxt.ctxt.cpu_policy = currd->arch.cpu_policy;
+
if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base,
&ctxt.cs.limit, &ar, 1) ||
!(ar & _SEGMENT_S) ||
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -344,7 +344,6 @@ int pv_ro_page_fault(unsigned long addr,
unsigned int addr_size = is_pv_32bit_domain(currd) ? 32 : BITS_PER_LONG;
struct x86_emulate_ctxt ctxt = {
.regs = regs,
- .cpu_policy = currd->arch.cpu_policy,
.addr_size = addr_size,
.sp_size = addr_size,
.lma = addr_size > 32,
@@ -352,6 +351,9 @@ int pv_ro_page_fault(unsigned long addr,
int rc;
bool mmio_ro;
+ /* Not part of the initializer, for old gcc to cope. */
+ ctxt.cpu_policy = currd->arch.cpu_policy;
+
/* Attempt to read the PTE that maps the VA being accessed. */
pte = guest_get_eff_kern_l1e(addr);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: fix build with old gcc after CPU policy changes
2023-04-18 10:15 [PATCH] x86: fix build with old gcc after CPU policy changes Jan Beulich
@ 2023-04-18 10:17 ` Andrew Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2023-04-18 10:17 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Wei Liu, Roger Pau Monné
On 18/04/2023 11:15 am, Jan Beulich wrote:
> Old gcc won't cope with initializers involving unnamed struct/union
> fields.
>
> Fixes: 441b1b2a50ea ("x86/emul: Switch x86_emulate_ctxt to cpu_policy")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Urgh. Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> I guess, but
I'd honestly far rather delete support for such obsolete compilers.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-18 10:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 10:15 [PATCH] x86: fix build with old gcc after CPU policy changes Jan Beulich
2023-04-18 10:17 ` Andrew Cooper
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.