From 7cc2fe0ddcc2dacbe0cbc86be1ee6b1cfac93cc6 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 30 Sep 2019 15:45:16 +0200 Subject: [PATCH] x86emul: move ARPL #UD check The #UD for being outside of protected mode gets raised for ARPL only after having read the memory operand - correct this by moving up the respective construct. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Release-acked-by: Juergen Gross --- xen/arch/x86/x86_emulate/x86_emulate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index f80beec502..22c29b8280 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -4061,6 +4061,8 @@ x86_emulate( /* arpl */ unsigned int src_rpl = dst.val & 3; + generate_exception_if(!in_protmode(ctxt, ops), EXC_UD); + dst = ea; dst.bytes = 2; if ( dst.type == OP_REG ) @@ -4078,7 +4080,6 @@ x86_emulate( _regs.eflags &= ~X86_EFLAGS_ZF; dst.type = OP_NONE; } - generate_exception_if(!in_protmode(ctxt, ops), EXC_UD); } break; -- 2.39.5