diff options
author | Gleb Natapov <gleb@redhat.com> | 2011-04-12 05:36:25 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-22 08:39:54 -0400 |
commit | 2aab2c5b2bac6510b3bd143ca83babee382f4302 (patch) | |
tree | 5b2cd8e63335f0b4c09f9106a58286febeb229b1 /arch/x86/kvm/x86.c | |
parent | 0004c7c25757f103ddb3a9e4bcfd533aad41f9a0 (diff) |
KVM: call cache_all_regs() only once during instruction emulation
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a9a307a75465..f5f2d3d44577 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4459,6 +4459,12 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) | |||
4459 | struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode; | 4459 | struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode; |
4460 | int cs_db, cs_l; | 4460 | int cs_db, cs_l; |
4461 | 4461 | ||
4462 | /* | ||
4463 | * TODO: fix emulate.c to use guest_read/write_register | ||
4464 | * instead of direct ->regs accesses, can save hundred cycles | ||
4465 | * on Intel for instructions that don't read/change RSP, for | ||
4466 | * for example. | ||
4467 | */ | ||
4462 | cache_all_regs(vcpu); | 4468 | cache_all_regs(vcpu); |
4463 | 4469 | ||
4464 | kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); | 4470 | kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); |
@@ -4562,14 +4568,6 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, | |||
4562 | 4568 | ||
4563 | kvm_clear_exception_queue(vcpu); | 4569 | kvm_clear_exception_queue(vcpu); |
4564 | 4570 | ||
4565 | /* | ||
4566 | * TODO: fix emulate.c to use guest_read/write_register | ||
4567 | * instead of direct ->regs accesses, can save hundred cycles | ||
4568 | * on Intel for instructions that don't read/change RSP, for | ||
4569 | * for example. | ||
4570 | */ | ||
4571 | cache_all_regs(vcpu); | ||
4572 | |||
4573 | if (!(emulation_type & EMULTYPE_NO_DECODE)) { | 4571 | if (!(emulation_type & EMULTYPE_NO_DECODE)) { |
4574 | init_emulate_ctxt(vcpu); | 4572 | init_emulate_ctxt(vcpu); |
4575 | vcpu->arch.emulate_ctxt.interruptibility = 0; | 4573 | vcpu->arch.emulate_ctxt.interruptibility = 0; |