Re: [PATCH 12/14] KVM: x86 emulator

From: Pavel Machek
Date: Tue Nov 07 2006 - 07:49:43 EST


HI!

> Add an x86 instruction emulator for kvm.
>
> We need an x86 emulator for the following reasons:
>
> - mmio instructions are intercepted as page faults, with no information about
> the operation to be performed other than the virtual address
> - real-mode is emulated using the old-fashined vm86 mode, with no special
> intercepts for the privileged instructions, so we need to emulate mov cr,
> lgdt, and lidt
> - we plan to cache shadow page tables in the future, so that a guest context
> switch will not throw away all the mappings we worked so hard to build. but
> cachine page tables means write-protecting the guest page tables to keep
> them in sync, so any writes to the guest page tables need to be emulated
>
> The emulator was lifted from the Xen hypervisor.
>
> Signed-off-by: Yaniv Kamay <yaniv@xxxxxxxxxxxx>
> Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx>
>
> Index: linux-2.6/drivers/kvm/x86_emulate.c
> ===================================================================
> --- /dev/null
> +++ linux-2.6/drivers/kvm/x86_emulate.c
> @@ -0,0 +1,1370 @@
> +/******************************************************************************
> + * x86_emulate.c
> + *
> + * Generic x86 (32-bit and 64-bit) instruction decoder and emulator.
> + *
> + * Copyright (c) 2005 Keir Fraser
> + *
> + * Linux coding style, mod r/m decoder, segment base fixes, real-mode
> + * privieged instructions:
> + *
> + * Copyright (C) 2006 Qumranet
> + *
> + * Avi Kivity <avi@xxxxxxxxxxxx>
> + * Yaniv Kamay <yaniv@xxxxxxxxxxxx>
> + *
> + * From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4
> + */

This needs GPL, I'd say.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/