From: Jan Beulich Date: Fri, 8 Sep 2017 14:23:46 +0000 (+0200) Subject: x86/HVM: correct repeat count update in linear->phys translation X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1465 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=49160d205236d8e36d27d40b6bf69b9b75f2c333;p=xen.git x86/HVM: correct repeat count update in linear->phys translation For the insn emulator's fallback logic in REP INS/OUTS handling to work correctly, *reps must not be set to zero when returning X86EMUL_UNHANDLEABLE. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Acked-by: Paul Durrant --- diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 64454c7825..54811c192a 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -566,15 +566,16 @@ static int hvmemul_linear_to_phys( if ( pfec & (PFEC_page_paged | PFEC_page_shared) ) return X86EMUL_RETRY; done /= bytes_per_rep; - *reps = done; if ( done == 0 ) { ASSERT(!reverse); if ( npfn != gfn_x(INVALID_GFN) ) return X86EMUL_UNHANDLEABLE; + *reps = 0; x86_emul_pagefault(pfec, addr & PAGE_MASK, &hvmemul_ctxt->ctxt); return X86EMUL_EXCEPTION; } + *reps = done; break; }