Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257982
b: refs/heads/master
c: b5c9ff7
h: refs/heads/master
v: v3
  • Loading branch information
Takuya Yoshikawa authored and Avi Kivity committed Jul 12, 2011
1 parent cf6b822 commit d5187a7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: adf52235b4082e67f31bf1fba36f1dce312633d6
refs/heads/master: b5c9ff731f3cee5a2f2d7154f48f8006b48eb66d
5 changes: 3 additions & 2 deletions trunk/arch/x86/include/asm/kvm_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,16 @@ struct decode_cache {
unsigned int d;
int (*execute)(struct x86_emulate_ctxt *ctxt);
int (*check_perm)(struct x86_emulate_ctxt *ctxt);
unsigned long regs[NR_VCPU_REGS];
unsigned long eip;
/* modrm */
u8 modrm;
u8 modrm_mod;
u8 modrm_reg;
u8 modrm_rm;
u8 modrm_seg;
bool rip_relative;
unsigned long eip;
/* Fields above regs are cleared together. */
unsigned long regs[NR_VCPU_REGS];
struct fetch_cache fetch;
struct read_cache io_read;
struct read_cache mem_read;
Expand Down
17 changes: 15 additions & 2 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4506,6 +4506,20 @@ static void inject_emulated_exception(struct kvm_vcpu *vcpu)
kvm_queue_exception(vcpu, ctxt->exception.vector);
}

static void init_decode_cache(struct decode_cache *c,
const unsigned long *regs)
{
memset(c, 0, offsetof(struct decode_cache, regs));
memcpy(c->regs, regs, sizeof(c->regs));

c->fetch.start = 0;
c->fetch.end = 0;
c->io_read.pos = 0;
c->io_read.end = 0;
c->mem_read.pos = 0;
c->mem_read.end = 0;
}

static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
{
struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt;
Expand All @@ -4531,8 +4545,7 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
X86EMUL_MODE_PROT16;
ctxt->guest_mode = is_guest_mode(vcpu);

memset(c, 0, sizeof(struct decode_cache));
memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);
init_decode_cache(c, vcpu->arch.regs);
vcpu->arch.emulate_regs_need_sync_from_vcpu = false;
}

Expand Down

0 comments on commit d5187a7

Please sign in to comment.