From nobody Sun Apr 28 19:51:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582302172; cv=none; d=zohomail.com; s=zohoarc; b=R+ty/zP7UevK2IOwbsqnq8AhgH5fN0VqxCnH27tfYnL6oZ3dChWsD7yVVNITgucb6Cfli4d5N7NgUSBkUqfW7/DsS1jj63nA+NVKmxtcmYLeN7zRX/BRbm9Cf6PMUD1XpaOCsYbxtJg/JXk1bMLdDrMm5ihcpwq/h7W98GiLMXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582302172; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=QlV6PTrsKM9eegByilijvW4b3zkmigFmOoaJ7S5tzUM=; b=BFThPJJmAP/1a3sTMSZ6f9Fz8/SIbsZDfYHgVCVBFfvHaXiGVYdmgR/bc4JXjfwwjtF8dhFetdECqzsvpg1o/59nSqYyn/C9oGsesBBJsz0ZJja9iVXoVM3Gq/Dyskdgc9H74XVcH+t196uZlPXVVIRec+jxIl03FfYyZos9XC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582302172625259.5585771659697; Fri, 21 Feb 2020 08:22:52 -0800 (PST) Received: from localhost ([::1]:60746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5B4l-0003h9-Kh for importer@patchew.org; Fri, 21 Feb 2020 11:22:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46032) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5B2V-0001pk-9R for qemu-devel@nongnu.org; Fri, 21 Feb 2020 11:20:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5B2U-0002kA-9Z for qemu-devel@nongnu.org; Fri, 21 Feb 2020 11:20:31 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:50592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5B2U-0002ju-1u for qemu-devel@nongnu.org; Fri, 21 Feb 2020 11:20:30 -0500 Received: by mail-wm1-x341.google.com with SMTP id a5so2380291wmb.0 for ; Fri, 21 Feb 2020 08:20:29 -0800 (PST) Received: from donizetti.fritz.box ([151.20.135.128]) by smtp.gmail.com with ESMTPSA id f62sm4653530wmf.36.2020.02.21.08.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 08:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QlV6PTrsKM9eegByilijvW4b3zkmigFmOoaJ7S5tzUM=; b=mV5T8xbdzBaGvY5GNxt9OV2YBNmEkSro11uM3uersXfIEh/36OtZuJu6eDcQHjdV7b ngHy3y03GEU2Jpkct/CovxY4uvwlcvhaJpCS8N2lixqkEt11scAB5H4P5YUCxDFANpLI V2Oj7a5JmDeU0GOnt/QtPtl439GIR4k86AgyvVMX0tH+Lm5AhrwxfSzujYI6xXsF2vqh GUrE4X6BSD/kPq86aKYvfXSU3U5AakhpEkf0BHGPQYv6Avtpe+qjzAPgPd90JDuSU5JQ BTqvoT8dzlE12BCtxjilBfKjPi6xEWPIUMjASr+vu7AcILvUOmSC6hYa1nWrZCQsP5ru kv8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=QlV6PTrsKM9eegByilijvW4b3zkmigFmOoaJ7S5tzUM=; b=TxrQBXByy4dng1G++QWBaMYKri5gAF/U9fYY+827fb5IQne0uMJivkTwS75oXKQvqW dr0afnZtWB495W4XzNwva0YWht10PAWNLq1pCe9UUo5QrSUA6z4FUOgStliS7XuhHyXk +KH9l/vyY28X3rqacdk9WSM2xYlbnuK70FVExF7LNfjbxEpEKhxsEK/iNQWS2MuU11gI +CbbzxxGOAEJk/WLt6P00b1UErIrZVCA0RxpKbg3xQVe5WZuf/RFv5p3D4tOq4Kl9p6Q O9SHTsPVfs/5c0INj8PzO4YZzhMaSTQj+X4Wzfcl6Qp9BjwVllXgEKQ9Od4aGEx6FzG3 doKA== X-Gm-Message-State: APjAAAXvzfDVth3ix/XPP2WN1q7N7Z29MoBl1AkEGJr7hvUlXjWEnRd/ 74GInKOlJ95j9nQdJoG29vfNsaSu X-Google-Smtp-Source: APXvYqwPDCrfkEDXnFSxbY5GQeVcn9RvRTModVGPo/FhIG7rGFDcBMj/9UWn2o0d+rRcw/xCPf+qsQ== X-Received: by 2002:a1c:dc85:: with SMTP id t127mr5064455wmg.16.1582302026528; Fri, 21 Feb 2020 08:20:26 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] target/i386: check for empty register in FXAM Date: Fri, 21 Feb 2020 17:20:24 +0100 Message-Id: <20200221162024.18808-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chengang@emindsoft.com.cn Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The fxam instruction returns the wrong result after fdecstp or after an underflow. Check fptags to handle this. Reported-by: Signed-off-by: Paolo Bonzini --- target/i386/fpu_helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c index 99f28f267f..792a128a6d 100644 --- a/target/i386/fpu_helper.c +++ b/target/i386/fpu_helper.c @@ -991,7 +991,11 @@ void helper_fxam_ST0(CPUX86State *env) env->fpus |=3D 0x200; /* C1 <-- 1 */ } =20 - /* XXX: test fptags too */ + if (env->fptags[env->fpstt]) { + env->fpus |=3D 0x4100; /* Empty */ + return; + } + expdif =3D EXPD(temp); if (expdif =3D=3D MAXEXPD) { if (MANTD(temp) =3D=3D 0x8000000000000000ULL) { --=20 2.21.1