]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86 emulator: add framework for instruction intercepts
authorAvi Kivity <avi@redhat.com>
Mon, 4 Apr 2011 10:39:22 +0000 (12:39 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 11 May 2011 11:57:00 +0000 (07:57 -0400)
commitb79fa6daeba7404da6a0d02baca4a707e206ed1d
tree371e0b43f62b8516870bb777dd967de5aa76b206
parented1833f09d957268ff973fce5e55e45bb3c58ee3
KVM: x86 emulator: add framework for instruction intercepts

When running in guest mode, certain instructions can be intercepted by
hardware.  This also holds for nested guests running on emulated
virtualization hardware, in particular instructions emulated by kvm
itself.

This patch adds a framework for intercepting instructions.  If an
instruction is marked for interception, and if we're running in guest
mode, a callback is called to check whether an intercept is needed or
not.  The callback is called at three points in time: immediately after
beginning execution, after checking privilge exceptions, and after
checking memory exception.  This suits the different interception points
defined for different instructions and for the various virtualization
instruction sets.

In addition, a new X86EMUL_INTERCEPT is defined, which any callback or
memory access may define, allowing the more complicated intercepts to be
implemented in existing callbacks.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/include/asm/kvm_emulate.h
arch/x86/kvm/emulate.c
arch/x86/kvm/x86.c