[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] improve emulation correctness
From: |
Dmitry Poletaev |
Subject: |
[Qemu-devel] [PATCH] improve emulation correctness |
Date: |
Fri, 25 Apr 2014 12:13:55 +0400 |
There is a set of test, that checks QEMU CPU for similar behavior with real
hardware (http://roberto.greyhats.it/projects/pills.html). Test reg/pill2579.c
can detect, that program is execute in emulated environment. It is related with
behavior of rcl instruction. If the number of shifted bits more than 1, OF of
eflags become undefined. Real CPUs does not change OF, if it is undefined. QEMU
do it anyway.
Emulated program can execute that test and after that can understand
environment not real.
Signed-off-by: Dmitry Poletaev <address@hidden>
diff --git a/target-i386/shift_helper_template.h
b/target-i386/shift_helper_template.h
index cf91a2d..d5bd321 100644
--- a/target-i386/shift_helper_template.h
+++ b/target-i386/shift_helper_template.h
@@ -64,8 +64,10 @@ target_ulong glue(helper_rcl, SUFFIX)(CPUX86State *env,
target_ulong t0,
}
t0 = res;
env->cc_src = (eflags & ~(CC_C | CC_O)) |
- (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O) |
((src >> (DATA_BITS - count)) & CC_C);
+ if (count == 1) {
+ env->cc_src |= (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O);
+ }
}
return t0;
}
This patch improve correctness of emulator behavior.
- [Qemu-devel] [PATCH] improve emulation correctness,
Dmitry Poletaev <=
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Richard Henderson, 2014/04/25
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Peter Maydell, 2014/04/25
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Michael Tokarev, 2014/04/27
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Peter Maydell, 2014/04/27
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Dmitry Poletaev, 2014/04/28
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Peter Maydell, 2014/04/28
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Dmitry Poletaev, 2014/04/28
- Re: [Qemu-devel] [PATCH] improve emulation correctness, Richard Henderson, 2014/04/28