]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: x86 emulator: fix mov r/m, sreg emulation.
authorGleb Natapov <gleb@redhat.com>
Thu, 18 Mar 2010 13:20:07 +0000 (15:20 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:16:00 +0000 (12:16 +0300)
mov r/m, sreg generates #UD ins sreg is incorrect.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/emulate.c

index 2c27aa466cf44498fc4683087980b4cc839352b2..c3b9334eb248fa584e28104fbc058d01bc93af47 100644 (file)
@@ -2126,12 +2126,11 @@ special_insn:
        case 0x8c: { /* mov r/m, sreg */
                struct kvm_segment segreg;
 
-               if (c->modrm_reg <= 5)
+               if (c->modrm_reg <= VCPU_SREG_GS)
                        kvm_get_segment(ctxt->vcpu, &segreg, c->modrm_reg);
                else {
-                       printk(KERN_INFO "0x8c: Invalid segreg in modrm byte 0x%02x\n",
-                              c->modrm);
-                       goto cannot_emulate;
+                       kvm_queue_exception(ctxt->vcpu, UD_VECTOR);
+                       goto done;
                }
                c->dst.val = segreg.selector;
                break;