]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: x86 emulator: implement LTR
authorAvi Kivity <avi@redhat.com>
Wed, 13 Jun 2012 13:33:29 +0000 (16:33 +0300)
committerAvi Kivity <avi@redhat.com>
Mon, 9 Jul 2012 11:19:05 +0000 (14:19 +0300)
Opcode 0F 00 /3.  Encountered during Windows XP secondary processor bringup.

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

index 92a1adde0b4443509b1fc57dcfcd8ea5aaf9e87d..97d9a9914ba8d772e522911252261110cfa58677 100644 (file)
@@ -3033,6 +3033,15 @@ static int em_lldt(struct x86_emulate_ctxt *ctxt)
        return load_segment_descriptor(ctxt, sel, VCPU_SREG_LDTR);
 }
 
+static int em_ltr(struct x86_emulate_ctxt *ctxt)
+{
+       u16 sel = ctxt->src.val;
+
+       /* Disable writeback. */
+       ctxt->dst.type = OP_NONE;
+       return load_segment_descriptor(ctxt, sel, VCPU_SREG_TR);
+}
+
 static int em_invlpg(struct x86_emulate_ctxt *ctxt)
 {
        int rc;
@@ -3579,7 +3588,7 @@ static struct opcode group6[] = {
        DI(Prot,        sldt),
        DI(Prot,        str),
        II(Prot | Priv | SrcMem16, em_lldt, lldt),
-       DI(Prot | Priv, ltr),
+       II(Prot | Priv | SrcMem16, em_ltr, ltr),
        N, N, N, N,
 };