From nobody Sun May 5 12:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1594518501; cv=none; d=zohomail.com; s=zohoarc; b=LrHVsDID/ZeabV+q0DF97g+LsfjDvoUyklBD1iC3XvjrC+gbWXvZM8uMwxRONd60ef2cP+U0L+SMCHONM86+IZ0dTPkxiy5XGZ/XSMHMAcg2RryBnd00eO4co5a8QqkdCKN+XznwXzwnMpqwAr9+N2rxqAIz036idhRV0k+WTsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594518501; 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=wNLt6/itAS4zBW028jjJy2h6V33ooOwoIY8nDOjUAxM=; b=XG5JnsS5D9hw9yCzyr61mbr3KyZWHOHtd+LGiu4W1Hsu4mhm/GuecGcNZqQvxkCyAETBxisCed5TEsr+HT4pEucz2VngNOLWroGOKmxpL2B3mpa4IAdpi0NGPa8f7mgNyuh4hZ1/mfYjHYG7iDWVKSiffyYet9MwGUaRTHYZtH4= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594518501371289.6396714205473; Sat, 11 Jul 2020 18:48:21 -0700 (PDT) Received: from localhost ([::1]:48924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juR6J-0000LJ-Od for importer@patchew.org; Sat, 11 Jul 2020 21:48:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juR5g-0008KR-Ey for qemu-devel@nongnu.org; Sat, 11 Jul 2020 21:47:40 -0400 Received: from lucky1.263xmail.com ([211.157.147.131]:41054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juR5d-0005j9-SW for qemu-devel@nongnu.org; Sat, 11 Jul 2020 21:47:40 -0400 Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 5F9C4AFDAF; Sun, 12 Jul 2020 09:47:26 +0800 (CST) Received: from localhost.localdomain (unknown [223.72.94.78]) by smtp.263.net (postfix) whith ESMTP id P9170T139648110163712S1594518440206160_; Sun, 12 Jul 2020 09:47:26 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 X-UNIQUE-TAG: <09f71800d8b843ef05390035df41848d> X-RL-SENDER: chengang@emindsoft.com.cn X-SENDER: chengang@emindsoft.com.cn X-LOGIN-NAME: chengang@emindsoft.com.cn X-FST-TO: pbonzini@redhat.com X-SENDER-IP: 223.72.94.78 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: chengang@emindsoft.com.cn To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com Subject: [PATCH] target: i386: mem_helper: Fix ldaxr instruction 64 bit alignment issue temporarily for stable-4.1 Date: Sun, 12 Jul 2020 09:47:17 +0800 Message-Id: <20200712014717.10858-1-chengang@emindsoft.com.cn> X-Mailer: git-send-email 2.24.0.308.g228f53135a MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=211.157.147.131; envelope-from=chengang@emindsoft.com.cn; helo=lucky1.263xmail.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/11 21:47:29 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Chen Gang This fix does not consider about the lock feature which may cause another issues, but excuse me, I don't know how to fix it. At present, the fix runs OK for my case in windows oledb32.dll in wine. Welcome anyone to fix it, thanks. Signed-off-by: Chen Gang --- target/i386/mem_helper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/i386/mem_helper.c b/target/i386/mem_helper.c index d50d4b0c40..8c37b05fae 100644 --- a/target/i386/mem_helper.c +++ b/target/i386/mem_helper.c @@ -68,7 +68,13 @@ void helper_cmpxchg8b(CPUX86State *env, target_ulong a0) uint64_t *haddr =3D g2h(a0); cmpv =3D cpu_to_le64(cmpv); newv =3D cpu_to_le64(newv); - oldv =3D atomic_cmpxchg__nocheck(haddr, cmpv, newv); + if ((unsigned long)haddr % 8) { + volatile uint64_t tmp =3D *haddr; /* avoid compiler optimizati= on */ + oldv =3D atomic_cmpxchg__nocheck(&tmp, cmpv, newv); + *haddr =3D tmp; + } else { + oldv =3D atomic_cmpxchg__nocheck(haddr, cmpv, newv); + } oldv =3D le64_to_cpu(oldv); } #else --=20 2.24.0.308.g228f53135a