]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: x86 emulator: move invlpg emulation into a function
authorAvi Kivity <avi@redhat.com>
Thu, 31 Mar 2011 16:48:09 +0000 (18:48 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 10 Apr 2011 09:48:03 +0000 (12:48 +0300)
It's going to get more complicated soon.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/emulate.c

index e3578cb5620eef66234dbd6da98c0a0b8a85a1be..7f0d9bee7437f91c7ae7fc27c409480235387bae 100644 (file)
@@ -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) {
@@ -3966,10 +3975,7 @@ twobyte_insn:
                        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;