]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/x86/kvm/emulate.c
KVM: x86: add support for UMIP
[linux.git] / arch / x86 / kvm / emulate.c
index abe74f779f9d793e9a6c2f19417f23b5aa7ce484..5edb252676288176581869f9f7836d4c40024b36 100644 (file)
@@ -3720,6 +3720,10 @@ static int emulate_store_desc_ptr(struct x86_emulate_ctxt *ctxt,
 {
        struct desc_ptr desc_ptr;
 
+       if ((ctxt->ops->get_cr(ctxt, 4) & X86_CR4_UMIP) &&
+           ctxt->ops->cpl(ctxt) > 0)
+               return emulate_gp(ctxt, 0);
+
        if (ctxt->mode == X86EMUL_MODE_PROT64)
                ctxt->op_bytes = 8;
        get(ctxt, &desc_ptr);
@@ -3779,6 +3783,10 @@ static int em_lidt(struct x86_emulate_ctxt *ctxt)
 
 static int em_smsw(struct x86_emulate_ctxt *ctxt)
 {
+       if ((ctxt->ops->get_cr(ctxt, 4) & X86_CR4_UMIP) &&
+           ctxt->ops->cpl(ctxt) > 0)
+               return emulate_gp(ctxt, 0);
+
        if (ctxt->dst.type == OP_MEM)
                ctxt->dst.bytes = 2;
        ctxt->dst.val = ctxt->ops->get_cr(ctxt, 0);