From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] x86_emulate: fix side-effect macro call Date: Tue, 5 Feb 2008 15:33:55 +0000 Message-ID: <20080205153355.GA10999@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 --- 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;