On 03.08.2023 04:33, Stefano Stabellini wrote: > On Wed, 2 Aug 2023, Nicola Vetrini wrote: >> @@ -2289,16 +2289,15 @@ static int cf_check hvmemul_cache_op( >> struct hvm_emulate_ctxt *hvmemul_ctxt = >> container_of(ctxt, struct hvm_emulate_ctxt, ctxt); >> uint32_t pfec = PFEC_page_present; >> + unsigned long addr; >> + int rc; >> + void *mapping; >> >> if ( !cache_flush_permitted(current->domain) ) >> return X86EMUL_OKAY; >> >> switch ( op ) >> { >> - unsigned long addr; >> - int rc; >> - void *mapping; > > These three could be... > > >> case x86emul_clflush: >> case x86emul_clflushopt: >> case x86emul_clwb: > > ... here in a new block
Except they're likely to be re-used as new enumerators are added. >> --- a/xen/arch/x86/x86_emulate/util-xen.c >> +++ b/xen/arch/x86/x86_emulate/util-xen.c >> @@ -77,10 +77,10 @@ bool cf_check x86_insn_is_portio(const struct >> x86_emulate_state *s, >> bool cf_check x86_insn_is_cr_access(const struct x86_emulate_state *s, >> const struct x86_emulate_ctxt *ctxt) >> { >> + unsigned int ext; >> + >> switch ( ctxt->opcode ) >> { >> - unsigned int ext; > > This can go under case X86EMUL_OPC with a new block Same here. Jan