WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [x86/32] Support two byte CMOVcc opcodes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [x86/32] Support two byte CMOVcc opcodes in 4G segment fixup.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 03 Jul 2007 13:36:26 -0700
Delivery-date: Tue, 03 Jul 2007 13:34:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [x86/32] Support two byte CMOVcc opcodes in 4G segment fixup., Xen patchbot-unstable <=