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-devel

[Xen-devel] [PATCH] x86_emulate: fix side-effect macro call

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] x86_emulate: fix side-effect macro call
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 5 Feb 2008 15:33:55 +0000
Delivery-date: Tue, 05 Feb 2008 07:35:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
x86_emulate: fix side-effect macro call
Both jmp_rel and insn_fetch_type increment eip, so it's not
compiler-safe to nest the calls.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

---
Yes, I actually got a bug because of this, with debian's gcc 4.2.3.

diff -r 52f222b319ef xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c        Tue Feb 05 11:21:22 2008 +0000
+++ b/xen/arch/x86/x86_emulate.c        Tue Feb 05 15:30:48 2008 +0000
@@ -2644,9 +2644,11 @@
         break;
     }
 
-    case 0xeb: /* jmp (short) */
-        jmp_rel(insn_fetch_type(int8_t));
+    case 0xeb: /* jmp (short) */ {
+        int8_t rel = insn_fetch_type(int8_t);
+        jmp_rel(rel);
         break;
+    }
 
     case 0xf1: /* int1 (icebp) */
         src.val = EXC_DB;

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

<Prev in Thread] Current Thread [Next in Thread>