* [PATCH] x86_emulate: fix side-effect macro call
@ 2008-02-05 15:33 Samuel Thibault
2008-02-05 15:37 ` Samuel Thibault
0 siblings, 1 reply; 2+ messages in thread
From: Samuel Thibault @ 2008-02-05 15:33 UTC (permalink / raw)
To: xen-devel
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@eu.citrix.com>
---
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86_emulate: fix side-effect macro call
2008-02-05 15:33 [PATCH] x86_emulate: fix side-effect macro call Samuel Thibault
@ 2008-02-05 15:37 ` Samuel Thibault
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2008-02-05 15:37 UTC (permalink / raw)
To: xen-devel
Samuel Thibault, le Tue 05 Feb 2008 15:33:55 +0000, a écrit :
> 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.
Another way to fix it would be to change jmp_rel:
- _regs.eip += (int)(rel);
+ int _rel = (int)(rel);
+ _regs.eip += _rel;
Samuel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-05 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05 15:33 [PATCH] x86_emulate: fix side-effect macro call Samuel Thibault
2008-02-05 15:37 ` Samuel Thibault
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.