summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2010-07-01 09:42:21 -0700
committerDoug Goldstein <cardoe@gentoo.org>2010-07-20 17:37:48 -0500
commitd472394e0474f1f660c8331d69e724b995a4fd7f (patch)
treea3966f4e3956b126ad5431088212838e803c036c /target-i386
parentblock/vvfat.c: fix warnings with _FORTIFY_SOURCE (diff)
downloadqemu-kvm-d472394e0474f1f660c8331d69e724b995a4fd7f.tar.gz
qemu-kvm-d472394e0474f1f660c8331d69e724b995a4fd7f.tar.bz2
qemu-kvm-d472394e0474f1f660c8331d69e724b995a4fd7f.zip
target-i386: fix xchg rax,r8
We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 7418027ea4fec276455abd4291558bc58a0a7ba7)
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/translate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 3de65bd1d..43aa54f14 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5296,6 +5296,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
break;
case 0x91 ... 0x97: /* xchg R, EAX */
+ do_xchg_reg_eax:
ot = dflag + OT_WORD;
reg = (b & 7) | REX_B(s);
rm = R_EAX;
@@ -6666,10 +6667,14 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
/************************/
/* misc */
case 0x90: /* nop */
- /* XXX: xchg + rex handling */
/* XXX: correct lock test for all insn */
- if (prefixes & PREFIX_LOCK)
+ if (prefixes & PREFIX_LOCK) {
goto illegal_op;
+ }
+ /* If REX_B is set, then this is xchg eax, r8d, not a nop. */
+ if (REX_B(s)) {
+ goto do_xchg_reg_eax;
+ }
if (prefixes & PREFIX_REPZ) {
gen_svm_check_intercept(s, pc_start, SVM_EXIT_PAUSE);
}