From patchwork Tue Dec 6 17:13:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 9462969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EF5B60231 for ; Tue, 6 Dec 2016 17:15:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79D7F2847E for ; Tue, 6 Dec 2016 17:15:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ED4C28487; Tue, 6 Dec 2016 17:15:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 127B42847E for ; Tue, 6 Dec 2016 17:15:29 +0000 (UTC) Received: from localhost ([::1]:33500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEJKy-0007S2-5k for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Dec 2016 12:15:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <3w_FGWAMKCoorxsu22uzs.q204s08-rs9sz121u18.25u@flex--dje.bounces.google.com>) id 1cEJKb-0007Qr-3g for qemu-devel@nongnu.org; Tue, 06 Dec 2016 12:15:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <3w_FGWAMKCoorxsu22uzs.q204s08-rs9sz121u18.25u@flex--dje.bounces.google.com>) id 1cEJKX-00029h-VU for qemu-devel@nongnu.org; Tue, 06 Dec 2016 12:15:05 -0500 Received: from mail-pg0-f74.google.com ([74.125.83.74]:33097) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <3w_FGWAMKCoorxsu22uzs.q204s08-rs9sz121u18.25u@flex--dje.bounces.google.com>) id 1cEJKX-000243-Pl for qemu-devel@nongnu.org; Tue, 06 Dec 2016 12:15:01 -0500 Received: by mail-pg0-f74.google.com with SMTP id p66so32876393pga.0 for ; Tue, 06 Dec 2016 09:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:message-id:date:subject:from:to; bh=T1ENt8GaiTQ32H05pniMcH7tQWKFypKmAKWA3zN5eOc=; b=bZ0uNgc7s3mJnpEY9/PRtCmS3UJ7r1C/i4MQEffKaOk0t0ruyCv7A9JbJbXH9jl1fr ETMr8lOuYo3sKOjGM12MXWTi1T/xt2FqInoP/g3wqCmrBwrIdpR24AppoBp4DKaCBXL2 O8rUqyXW+BbaUdJgtLGFd658Vb+EiHNVt3BGgwwo0cueWdybxNLJ9KwGYQ2TKFHfVKkd CXSR8FGhtSpOXv+jZVCM0LA5BmuVAQdEOZzJQ4TYb2XwD6K3hliYpTCWtMkpwp4aY9A7 EUd4yqg2vYMWkjEnI4Ey1nyOYdcl0YJplz2vAbkjmRLObqdN2LkI1eT4yY7f2h5OyFMJ am4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to; bh=T1ENt8GaiTQ32H05pniMcH7tQWKFypKmAKWA3zN5eOc=; b=gH2AKtQh1LJK25gaTL0cd6CwLrP3fspsZNcZ9ZImRtdMR/hzxH+HvNeb5thYD+4SbR J03n/97WK2hk0SW7ZwQnH1lfM65/t1KqY8yO5uk4botbimoFS76noPX/V3enGU5RnBsN AHu2eRjuXXp3FOAzbon2GU4gOo0Yu7bEI7rZtiWp/DqVjhJwBU145r0k8T61K8Z1MUsK URhlGRGj+lljdyk6kkeeAnqtkk3BQ/8L6VS6PxluqbIa3q4rHJ9l0XOPKACd18bbZbCo pEY8KvL+M3Ykw6xwNYEWr3iP1+KnHsDkp1YDJ1Y1ox88SwEes8NmZE6KjESn0Fp22km7 twiw== X-Gm-Message-State: AKaTC02p96zHH/X272fF3XFQjhgElZ9G3r1RR6s/SUFIS9IjWaQofvJwkEsWZuXpAlHvh2CBm5a9t9Y81yU0nwZ4nD2OKqU0E5JF2vjJqJLqf2C3y7ISN44d32wT/JzwLaAL3gpRg49uNKKDEtRc2Aq+l9dE7yNWlC3ftJaYgxk6Cho= MIME-Version: 1.0 X-Received: by 10.98.93.201 with SMTP id n70mr12106939pfj.43.1481044419133; Tue, 06 Dec 2016 09:13:39 -0800 (PST) Message-ID: <001a113ec6308021110543008630@google.com> Date: Tue, 06 Dec 2016 17:13:39 +0000 From: Doug Evans To: qemu-devel@nongnu.org, pbonzini@redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.83.74 Subject: [Qemu-devel] [PATCH] x86: Fix eflags tracking for syscall insn X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi. While researching an issue related to the syscall insn it seemed like eflags status tracking was missing this step. I think(!) this is correct, it follows what similar code does elsewhere, and what the doc says. If it's not correct IWBN to clarify the situation. commit 393243eda30d4429a07a0f7c29b0f6297616a355 Author: Doug Evans Date: Tue Dec 6 09:00:42 2016 -0800 syscall insn: update eflags to CC_OP_EFLAGS Signed-off-by: Doug Evans case 0x107: /* sysret */ diff --git a/target-i386/translate.c b/target-i386/translate.c index 324103c..9fd1a04 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7104,6 +7104,10 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_syscall(cpu_env, tcg_const_i32(s->pc - pc_start)); + /* condition codes are modified only in long mode */ + if (s->lma) { + set_cc_op(s, CC_OP_EFLAGS); + } gen_eob(s); break;