On Fri, May 15, 2009 at 10:22:17AM +0200, Alexander Graf wrote:
> If we couldn't find a page on read_emulated, it might be a good
> idea to tell the guest about that and inject a #PF.
> 
> We do the same already for write faults. I don't know why it was
> not implemented for reads.

Have you checked that the emulator will never ever do speculative reads?
This may be the reason why the fault was not injected here.

> 
> Signed-off-by: Alexander Graf <ag...@suse.de>
> ---
>  arch/x86/kvm/x86.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 5fcde2c..5aa1219 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2131,10 +2131,13 @@ static int emulator_read_emulated(unsigned long addr,
>               goto mmio;
>  
>       if (kvm_read_guest_virt(addr, val, bytes, vcpu)
> -                             == X86EMUL_CONTINUE)
> +                             == X86EMUL_CONTINUE) {
>               return X86EMUL_CONTINUE;
> -     if (gpa == UNMAPPED_GVA)
> +     }
> +     if (gpa == UNMAPPED_GVA) {
> +             kvm_inject_page_fault(vcpu, addr, 0);
>               return X86EMUL_PROPAGATE_FAULT;
> +     }
>  
>  mmio:
>       /*
> -- 
> 1.6.0.2
> 
> 

-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to