diff options
author | Laurent Vivier <Laurent.Vivier@bull.net> | 2007-09-18 05:27:37 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:52:47 -0500 |
commit | 3427318fd2244737a466a06a93c5fe579852f871 (patch) | |
tree | 7c6760dbbdd067498c470e6e4f711e5baeef491c /drivers/kvm/vmx.c | |
parent | 1be3aa47182e94944e57b176a5c4ee4e74f1ce33 (diff) |
KVM: Call x86_decode_insn() only when needed
Move emulate_ctxt to kvm_vcpu to keep emulate context when we exit from kvm
module. Call x86_decode_insn() only when needed. Modify x86_emulate_insn() to
not modify the context if it must be re-entered.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 47c827d3007c..91768d5dbfb9 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1750,7 +1750,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, | |||
1750 | * Cause the #SS fault with 0 error code in VM86 mode. | 1750 | * Cause the #SS fault with 0 error code in VM86 mode. |
1751 | */ | 1751 | */ |
1752 | if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0) | 1752 | if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0) |
1753 | if (emulate_instruction(vcpu, NULL, 0, 0) == EMULATE_DONE) | 1753 | if (emulate_instruction(vcpu, NULL, 0, 0, 0) == EMULATE_DONE) |
1754 | return 1; | 1754 | return 1; |
1755 | return 0; | 1755 | return 0; |
1756 | } | 1756 | } |
@@ -1787,7 +1787,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1787 | } | 1787 | } |
1788 | 1788 | ||
1789 | if (is_invalid_opcode(intr_info)) { | 1789 | if (is_invalid_opcode(intr_info)) { |
1790 | er = emulate_instruction(vcpu, kvm_run, 0, 0); | 1790 | er = emulate_instruction(vcpu, kvm_run, 0, 0, 0); |
1791 | if (er != EMULATE_DONE) | 1791 | if (er != EMULATE_DONE) |
1792 | vmx_inject_ud(vcpu); | 1792 | vmx_inject_ud(vcpu); |
1793 | 1793 | ||
@@ -1812,7 +1812,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1812 | return 1; | 1812 | return 1; |
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | er = emulate_instruction(vcpu, kvm_run, cr2, error_code); | 1815 | er = emulate_instruction(vcpu, kvm_run, cr2, error_code, 0); |
1816 | mutex_unlock(&vcpu->kvm->lock); | 1816 | mutex_unlock(&vcpu->kvm->lock); |
1817 | 1817 | ||
1818 | switch (er) { | 1818 | switch (er) { |
@@ -1873,7 +1873,8 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1873 | string = (exit_qualification & 16) != 0; | 1873 | string = (exit_qualification & 16) != 0; |
1874 | 1874 | ||
1875 | if (string) { | 1875 | if (string) { |
1876 | if (emulate_instruction(vcpu, kvm_run, 0, 0) == EMULATE_DO_MMIO) | 1876 | if (emulate_instruction(vcpu, |
1877 | kvm_run, 0, 0, 0) == EMULATE_DO_MMIO) | ||
1877 | return 0; | 1878 | return 0; |
1878 | return 1; | 1879 | return 1; |
1879 | } | 1880 | } |