diff options
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 38173343153f..9715d6ea7d72 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1861,7 +1861,7 @@ static int em_pusha(struct x86_emulate_ctxt *ctxt) | |||
1861 | 1861 | ||
1862 | static int em_pushf(struct x86_emulate_ctxt *ctxt) | 1862 | static int em_pushf(struct x86_emulate_ctxt *ctxt) |
1863 | { | 1863 | { |
1864 | ctxt->src.val = (unsigned long)ctxt->eflags; | 1864 | ctxt->src.val = (unsigned long)ctxt->eflags & ~EFLG_VM; |
1865 | return em_push(ctxt); | 1865 | return em_push(ctxt); |
1866 | } | 1866 | } |
1867 | 1867 | ||
@@ -2130,7 +2130,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) | |||
2130 | /* Outer-privilege level return is not implemented */ | 2130 | /* Outer-privilege level return is not implemented */ |
2131 | if (ctxt->mode >= X86EMUL_MODE_PROT16 && (cs & 3) > cpl) | 2131 | if (ctxt->mode >= X86EMUL_MODE_PROT16 && (cs & 3) > cpl) |
2132 | return X86EMUL_UNHANDLEABLE; | 2132 | return X86EMUL_UNHANDLEABLE; |
2133 | rc = __load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS, 0, false, | 2133 | rc = __load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS, cpl, false, |
2134 | &new_desc); | 2134 | &new_desc); |
2135 | if (rc != X86EMUL_CONTINUE) | 2135 | if (rc != X86EMUL_CONTINUE) |
2136 | return rc; | 2136 | return rc; |
@@ -4172,8 +4172,8 @@ static const struct opcode opcode_map_0f_38[256] = { | |||
4172 | /* 0x80 - 0xef */ | 4172 | /* 0x80 - 0xef */ |
4173 | X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), | 4173 | X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), X16(N), |
4174 | /* 0xf0 - 0xf1 */ | 4174 | /* 0xf0 - 0xf1 */ |
4175 | GP(EmulateOnUD | ModRM | Prefix, &three_byte_0f_38_f0), | 4175 | GP(EmulateOnUD | ModRM, &three_byte_0f_38_f0), |
4176 | GP(EmulateOnUD | ModRM | Prefix, &three_byte_0f_38_f1), | 4176 | GP(EmulateOnUD | ModRM, &three_byte_0f_38_f1), |
4177 | /* 0xf2 - 0xff */ | 4177 | /* 0xf2 - 0xff */ |
4178 | N, N, X4(N), X8(N) | 4178 | N, N, X4(N), X8(N) |
4179 | }; | 4179 | }; |
@@ -4801,6 +4801,12 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) | |||
4801 | goto done; | 4801 | goto done; |
4802 | } | 4802 | } |
4803 | 4803 | ||
4804 | /* Instruction can only be executed in protected mode */ | ||
4805 | if ((ctxt->d & Prot) && ctxt->mode < X86EMUL_MODE_PROT16) { | ||
4806 | rc = emulate_ud(ctxt); | ||
4807 | goto done; | ||
4808 | } | ||
4809 | |||
4804 | /* Privileged instruction can be executed only in CPL=0 */ | 4810 | /* Privileged instruction can be executed only in CPL=0 */ |
4805 | if ((ctxt->d & Priv) && ops->cpl(ctxt)) { | 4811 | if ((ctxt->d & Priv) && ops->cpl(ctxt)) { |
4806 | if (ctxt->d & PrivUD) | 4812 | if (ctxt->d & PrivUD) |
@@ -4810,12 +4816,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) | |||
4810 | goto done; | 4816 | goto done; |
4811 | } | 4817 | } |
4812 | 4818 | ||
4813 | /* Instruction can only be executed in protected mode */ | ||
4814 | if ((ctxt->d & Prot) && ctxt->mode < X86EMUL_MODE_PROT16) { | ||
4815 | rc = emulate_ud(ctxt); | ||
4816 | goto done; | ||
4817 | } | ||
4818 | |||
4819 | /* Do instruction specific permission checks */ | 4819 | /* Do instruction specific permission checks */ |
4820 | if (ctxt->d & CheckPerm) { | 4820 | if (ctxt->d & CheckPerm) { |
4821 | rc = ctxt->check_perm(ctxt); | 4821 | rc = ctxt->check_perm(ctxt); |