[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [x86/32] Support two byte CMOVcc opcodes in 4G segment fixup.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1183478690 -3600
# Node ID f1b62eb7f8be42485356382ac0f6bf5f5a430c22
# Parent  56da8753ba8d958e29262a45052a72dd7cfbaa79
[x86/32] Support two byte CMOVcc opcodes in 4G segment fixup.

These are present in Debian Etch's libc6-i686 package.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 xen/arch/x86/x86_32/seg_fixup.c |   84 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 80 insertions(+), 4 deletions(-)

diff -r 56da8753ba8d -r f1b62eb7f8be xen/arch/x86/x86_32/seg_fixup.c
--- a/xen/arch/x86/x86_32/seg_fixup.c   Tue Jul 03 16:02:31 2007 +0100
+++ b/xen/arch/x86/x86_32/seg_fixup.c   Tue Jul 03 17:04:50 2007 +0100
@@ -93,6 +93,57 @@ static unsigned char insn_decode[256] = 
     X, X, X, X, X, X, O|M, O|M
 };
 
+static unsigned char twobyte_decode[256] = {
+    /* 0x00 - 0x0F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x10 - 0x1F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x20 - 0x2F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x30 - 0x3F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x40 - 0x4F */
+    O|M, O|M, O|M, O|M, O|M, O|M, O|M, O|M,
+    O|M, O|M, O|M, O|M, O|M, O|M, O|M, O|M,
+    /* 0x50 - 0x5F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x60 - 0x6F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x70 - 0x7F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x80 - 0x8F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0x90 - 0x9F */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0xA0 - 0xAF */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0xB0 - 0xBF */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0xC0 - 0xCF */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0xD0 - 0xDF */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0xE0 - 0xEF */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X,
+    /* 0xF0 - 0xFF */
+    X, X, X, X, X, X, X, X,
+    X, X, X, X, X, X, X, X
+};
+
 /*
  * Obtain the base and limit associated with the given segment selector.
  * The selector must identify a 32-bit code or data segment. Any segment that
@@ -275,6 +326,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     u8            *eip;         /* ptr to instruction start */
     u8            *pb, b;       /* ptr into instr. / current instr. byte */
     int            gs_override = 0;
+    int            twobyte = 0;
 
     /* WARNING: We only work for ring-3 segments. */
     if ( unlikely(vm86_mode(regs)) || unlikely(!ring_3(regs)) )
@@ -337,12 +389,36 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     decode = insn_decode[b]; /* opcode byte */
     pb++;
+    if ( decode == 0 && b == 0x0f )
+    {
+        twobyte = 1;
+
+        if ( get_user(b, pb) )
+        {
+            dprintk(XENLOG_DEBUG,
+                    "Fault while accessing byte %ld of instruction\n",
+                    (long)(pb-eip));
+            goto page_fault;
+        }
+
+        if ( (pb - eip) >= 15 )
+        {
+            dprintk(XENLOG_DEBUG, "Too many opcode bytes for a "
+                    "legal instruction\n");
+            goto fail;
+        }
+
+        decode = twobyte_decode[b];
+        pb++;
+    }
+
     if ( decode == 0 )
     {
-        dprintk(XENLOG_DEBUG, "Unsupported opcode %02x\n", b);
-        goto fail;
-    }
-    
+        dprintk(XENLOG_DEBUG, "Unsupported %sopcode %02x\n",
+                twobyte ? "two byte " : "", b);
+        goto fail;
+    }
+
     if ( !(decode & HAS_MODRM) )
     {
         /* Must be a <disp32>, or bail. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.