Skip to content

Commit

Permalink
KVM: x86 emulator: move invlpg emulation into a function
Browse files Browse the repository at this point in the history
It's going to get more complicated soon.

Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Avi Kivity committed May 11, 2011
1 parent 3ca3ac4 commit 3850391
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,15 @@ static int em_movdqu(struct x86_emulate_ctxt *ctxt)
return X86EMUL_CONTINUE;
}

static int em_invlpg(struct x86_emulate_ctxt *ctxt)
{
struct decode_cache *c = &ctxt->decode;
emulate_invlpg(ctxt->vcpu, linear(ctxt, c->src.addr.mem));
/* Disable writeback. */
c->dst.type = OP_NONE;
return X86EMUL_CONTINUE;
}

static bool valid_cr(int nr)
{
switch (nr) {
Expand Down Expand Up @@ -3966,10 +3975,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
rc = X86EMUL_PROPAGATE_FAULT;
goto done;
case 7: /* invlpg*/
emulate_invlpg(ctxt->vcpu,
linear(ctxt, c->src.addr.mem));
/* Disable writeback. */
c->dst.type = OP_NONE;
rc = em_invlpg(ctxt);
break;
default:
goto cannot_emulate;
Expand Down

0 comments on commit 3850391

Please sign in to comment.