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) {
                        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;