]> xenbits.xensource.com Git - xen.git/commitdiff
x86/HVM: correct repeat count update in linear->phys translation
authorJan Beulich <jbeulich@suse.com>
Fri, 6 Oct 2017 12:57:55 +0000 (14:57 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Oct 2017 12:57:55 +0000 (14:57 +0200)
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 <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Paul Durrant <paul.durrant@citrix.com>
master commit: 49160d205236d8e36d27d40b6bf69b9b75f2c333
master date: 2017-09-08 16:23:46 +0200

xen/arch/x86/hvm/emulate.c

index ca13722c982692476c64bc0654f8ff7f5257e463..af09dcc13616707be538976283b08593da19dbe3 100644 (file)
@@ -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;
         }