public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: kvm-devel <kvm@vger.kernel.org>
Subject: x86: Corrupted eflags in qemu's CPU state
Date: Mon, 26 Jan 2009 16:49:59 +0100	[thread overview]
Message-ID: <497DDBA7.1040103@siemens.com> (raw)

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

             reply	other threads:[~2009-01-26 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26 15:49 Jan Kiszka [this message]
2009-01-26 16:54 ` x86: Corrupted eflags in qemu's CPU state 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=497DDBA7.1040103@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox