public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* x86: Corrupted eflags in qemu's CPU state
@ 2009-01-26 15:49 Jan Kiszka
  2009-01-26 16:54 ` Glauber Costa
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2009-01-26 15:49 UTC (permalink / raw)
  To: kvm-devel

Hi,

this line almost ruined my afternoon:

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 01748ed..4ad386b 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -429,7 +429,6 @@ void kvm_arch_save_regs(CPUState *env)
     env->cc_src = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
     env->df = 1 - (2 * ((env->eflags >> 10) & 1));
     env->cc_op = CC_OP_EFLAGS;
-    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
 
     /* msrs */
     n = 0;

The guest flags reported via gdb or monitor were garbage and I first
didn't realized this...

git logs revealed that commit 6eecdc3eea74ead3c11b8b43d825d2cabe7a2456
once introduced it mid of 2006, but maybe under different boundary
conditions. At least today it appears to be plain wrong, eflags must
always contain to full state, cc_src, df & cc_op are just supplementary
states. Please correct me if I'm wrong, otherwise I will send out a
proper patch, also upstream as QEMU's kvm suffers from the same issue.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-26 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-26 15:49 x86: Corrupted eflags in qemu's CPU state Jan Kiszka
2009-01-26 16:54 ` Glauber Costa
2009-01-26 17:52   ` [PATCH] x86-userspace: Remove eflags conversion into emulator format Jan Kiszka
2009-01-26 21:39     ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox