Commit 2aab2c5b authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity

KVM: call cache_all_regs() only once during instruction emulation

Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 0004c7c2
...@@ -4459,6 +4459,12 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) ...@@ -4459,6 +4459,12 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode; struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
int cs_db, cs_l; int cs_db, cs_l;
/*
* TODO: fix emulate.c to use guest_read/write_register
* instead of direct ->regs accesses, can save hundred cycles
* on Intel for instructions that don't read/change RSP, for
* for example.
*/
cache_all_regs(vcpu); cache_all_regs(vcpu);
kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); 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,14 +4568,6 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
kvm_clear_exception_queue(vcpu); kvm_clear_exception_queue(vcpu);
/*
* TODO: fix emulate.c to use guest_read/write_register
* instead of direct ->regs accesses, can save hundred cycles
* on Intel for instructions that don't read/change RSP, for
* for example.
*/
cache_all_regs(vcpu);
if (!(emulation_type & EMULTYPE_NO_DECODE)) { if (!(emulation_type & EMULTYPE_NO_DECODE)) {
init_emulate_ctxt(vcpu); init_emulate_ctxt(vcpu);
vcpu->arch.emulate_ctxt.interruptibility = 0; vcpu->arch.emulate_ctxt.interruptibility = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment