From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428487; cv=none; d=zohomail.com; s=zohoarc; b=W85OoApl2XMmPPgmysQha6GoBczjsgtSYjx9OXqAEhl4iF494/yUHAwfjlj3cxgCZ9rqcAUAEC053mRHWb3jjCm8vgpfdRw166HUmbTJ5xOGDXOaTszTa3CR5XVEw7ZChNvwuuwUfCPDj46nveweeysrmwcHbA6Y7lJlhJkMQkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428487; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M9q5UQizGwrMYMCi99D6HLSzNEy+uYysxva9bCXYLNI=; b=nMNKz1JzCVlqzOEuRPXzTORNunn+R2ipHFfeFdPMXZbsiwXC9JwVz31jd5pJE/So8TTp2CNk+0gxIRRpMEIr3Y7+9IwXiaNj4v2xRYLKGnMhMZZuOHFy3taHyI9/iDk4guVW4IlYaOHQIRmzhYEe1h4SUQ3UVyTedX5LNgYylvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428487650703.4161706907239; Sat, 11 May 2024 04:54:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIn-0000HC-OD; Sat, 11 May 2024 07:54:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIm-0000GZ-CU for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:08 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIk-0006wF-Qr for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:08 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-34de61b7ca4so1940336f8f.2 for ; Sat, 11 May 2024 04:54:05 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428444; x=1716033244; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M9q5UQizGwrMYMCi99D6HLSzNEy+uYysxva9bCXYLNI=; b=f6Ax+JFy7Y7AzCDnAoPhZwmvIiDWEuXrZglacz0b4l1qmuEtYe1o2+8j7iUQ6sL+Cd aVDA9REDeR/1n+7YAeSQm4quKvP91Nn1pWkFAc3Pj1pUjFxTtZ5OC9nFnfW7+7o4BjFq ZWg28cGo+Ku+Qll7MnyAY1XClia0SxjOBoBWgfmg13k10O2aACczVMGY+E3YXQtazo11 i4ZKzk0Rd+c2nd2SyFD/EKqJ/H3tVsU1SWwUWO56bzp4yA1ZzdqfK0MxW36M6r0trAV5 ett+WrKDJPpc+o1jVPxXrca76pq1DPP3v1yA5rzxx/zrYDEOiWfiHhqdivESUTFmEjIM J0rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428444; x=1716033244; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M9q5UQizGwrMYMCi99D6HLSzNEy+uYysxva9bCXYLNI=; b=hxP7mh6tavcXPJPDcaKKQmCwXg5QlVFUmEPFwiu0dTQXbIEiii5vhNz9UFt1KmGsT3 9VgXkVTODEYEdHsLab2cvU5OdH23Zoi5poUiuZSLGwtgb//YSR1UBGr7+nUaDf+6SOta sgG8XB+6AhJ/cldLbchPn75LjFtnu/yHJttzxeo00uEqnRkUKgZEKx5InxdT+b4ENKGA CBQsUoIm2dAXbyDk2oxRsGMrFHV1nimOjiv+tjo0pXSZRFI/IxkBrQeiPs6OqvaMCWzF uqLtf6Ifjdg2a0Ar/FG/BgqJ+jUUNBE47sH/WyJz/T8aLvY6G/8OxqRuy/+JyaqLDoFJ TACQ== X-Gm-Message-State: AOJu0YxON1fRcINXTxVKkeeS1mBhUVBXe2K3mXjr2ZkcQyBC2XQFCXNI zi47r8Kx3JGAy73hedZUiHo7uWYZv5IIbxllEMlU5bgzPssAbzRp59PnAUxQpOPeYHMlO3y4kOc CD/Q= X-Google-Smtp-Source: AGHT+IFQzbgcKT7k+7lSnmBZAy4bCKZmrkQa/ErK5nU2JeOet9dpiAAc5WGy4nRLKaA6J6i0hh+Ahw== X-Received: by 2002:adf:e851:0:b0:343:ddbe:4579 with SMTP id ffacd0b85a97d-3504a61c790mr4880986f8f.1.1715428444031; Sat, 11 May 2024 04:54:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 01/17] ppc64: Fix include order Date: Sat, 11 May 2024 13:53:44 +0200 Message-Id: <20240511115400.7587-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428488404100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu_ppc64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/risu_ppc64.c b/risu_ppc64.c index 9df8d58..62cf6aa 100644 --- a/risu_ppc64.c +++ b/risu_ppc64.c @@ -11,9 +11,8 @@ * based on Peter Maydell's risu_arm.c *************************************************************************= ****/ =20 -#include - #include "risu.h" +#include =20 void advance_pc(void *vuc) { --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428524; cv=none; d=zohomail.com; s=zohoarc; b=g00xyNi37LNiuqeCPsG4t3ZXj4uVl/ySKSSnS0MvmwZK50jO04f2CswD1R9F0KNgvcqONjKhbaQVt2+tmYPRFckfRUEQQGlA3aCbJuovzlQDYeW3l+pFivjuft0544m/MBakdFmhEbjAR1KCHp6Uf8dWReMiHrrYJIaWxfpc9Wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428524; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+j17CWT0LGOl4p0U3kdloXB6QscEHqrtuA6J/qKLXl4=; b=UXzmheAyDiHtQmzRWp7WNazGyLKqUUraByGnuHgo8C2mfkAxDmM6kKe6NeRcI2ql+VJo7TtXOAwCgyACU7qLcjaoVhrqaFoX+uHTElaFd7LHZz1Lp0HzoyTIGNxGmsUgQd+JfmWVcGN4SogFQC1XxZvX1y4ZIST3+CT6MM021A8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428524536975.793552855192; Sat, 11 May 2024 04:55:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIo-0000HS-Ep; Sat, 11 May 2024 07:54:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIm-0000Gi-Tp for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:08 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIl-0006wu-5q for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:08 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-34e0d8b737eso2208501f8f.1 for ; Sat, 11 May 2024 04:54:05 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428445; x=1716033245; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+j17CWT0LGOl4p0U3kdloXB6QscEHqrtuA6J/qKLXl4=; b=vVHqsLXPNxYuVbhbWU93fxnm7NecPSh0RNaNNte4T8kNlCJHXKG59PoQbnhmRqqMri PaiNzIh9lqRgv+PNRyvPDywV0Z4OqN+A/YwiQ9/0KaBsoy3ZZt2eFSdSdoukkXDBfsPq 4pNjPN5G8vz599rNJq7A0ZQiyl1+34c9Tcz/yz7INdcNKO+LhrF6d99YbfPs2UoWZA4y Y2vaD4tHv4qNfnLUEBbGwlTs6TncbNGr3T3e0zS/4AOCio5D6slPKzxCoMCAN603308g AaRj8yG2NRJjQHgbPYl0OI4fANENHRYyLaDNmsWpObax8NxQ5oiPC7+mW3iggjqrD6pm 3UYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428445; x=1716033245; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+j17CWT0LGOl4p0U3kdloXB6QscEHqrtuA6J/qKLXl4=; b=bjzbs4OzJR6qa2SQ7ntPqEoAOTQjiK0Us5U24EbvEdP8otANSYakcckyKn9PtXgluv o33rmDB3PJjdxVD7kwV2ZQp6flbEixNpBisvuWInEA7Qgv+7VFrKgyAhMaL1620B/gW6 uVZHoc5sQeitvZTP8ECJ9hd4F8LvfkGBdS/ligj1kIkrJu9RSuNUuObZc80vZ0xvfo5y cvCSmwKntQAisnbG4gocqFGxVix/XgxEdCwY3+ti2KKc4kCNPwpW09UEIHJTrQBVBfIT GnqAr0Ir+F3gystUIrK9kzHLbMoMYZ3FbBmKCP4i4ydEc47OGU5+oDoqgTxqdzMwGVwE 06Vg== X-Gm-Message-State: AOJu0YylhVBomnuiFoIe0jtcdsRPhYRWjBdZ5XU7dR5YUfxpEC88PrD/ 9kTFE44plJOgj4ZrVnivXe2hZCfAEsjKOEHngbxNOCEUu17zoUjcZQxq8Bx6M+NrFP14ipZ1LVc J/7E= X-Google-Smtp-Source: AGHT+IFr4C3gvHo1cHIEG6/1tTC1W/BSVKtAdIY4/Hmw6XA228rk17CpXjeWPfMIEF39Sh9q59eFLg== X-Received: by 2002:a5d:6952:0:b0:34d:8d11:f8c0 with SMTP id ffacd0b85a97d-350498a4abfmr4192581f8f.18.1715428444827; Sat, 11 May 2024 04:54:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 02/17] Fix load_image error check for mmap Date: Sat, 11 May 2024 13:53:45 +0200 Message-Id: <20240511115400.7587-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428526198100003 Content-Type: text/plain; charset="utf-8" mmap does not return null on failure, but MAP_FAILED. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/risu.c b/risu.c index 36fc82a..6b6295c 100644 --- a/risu.c +++ b/risu.c @@ -362,10 +362,9 @@ static void load_image(const char *imgfile) /* Map writable because we include the memory area for store * testing in the image. */ - addr =3D - mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, - 0); - if (!addr) { + addr =3D mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, fd, 0); + if (addr =3D=3D MAP_FAILED) { perror("mmap"); exit(EXIT_FAILURE); } --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428603; cv=none; d=zohomail.com; s=zohoarc; b=MdWlLVNMR23DRpIH5DDpJb7bFztkAXBUU3pSU+QmwUzyebZ9lopW0S9QCArjcMHKICt0l+v//6WgV8rhXu9ntjMixzMqKnhBY0VoehkOhArG/uB3v3dq3efOO5vuwxNZ+RXJJ9GJptCyWgcsmulzLFFid0+sr7SSbMHQOUuwuCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428603; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9nf//qjvXctRXrrQe7LSzMsk4uBFI3ROnap3D79JgrM=; b=lnvVMhYCwa/EQAtRVXuQyoucJ4zCLqJg3ZEDIpVWDRNe5KEEXTGin7RjgkVFZ1p0KOA0hy1uaWhxSrbwNt2W6t8HkAdpWUTc//o8lVA3k51C6BJExksLKELwIBRqoZX4KYT6DUQtmqjnUFzf50T1yR3ETzMZuRBdszaLPQ3gs+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428603564110.79058830018323; Sat, 11 May 2024 04:56:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIp-0000IM-K8; Sat, 11 May 2024 07:54:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIo-0000HN-A0 for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:10 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIl-0006xC-FG for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:10 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41fd5dc04f0so16228005e9.0 for ; Sat, 11 May 2024 04:54:06 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428446; x=1716033246; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9nf//qjvXctRXrrQe7LSzMsk4uBFI3ROnap3D79JgrM=; b=bnQGp7Qmfb686F83QJUOGbue7Xno3heYn33snNbxykFRqzXYP5Hok7rCrOcbt2OOFy xu+9LS0GA24lqiCbr7wqGHGL2JAnT8lBhjGzkEGu4VSwMp2w9GNH/EQ0VldUzCgwu8CY Qh8+rlqfsKV2uREX9wbPidCpqcCTUGvduyep8vr8Uqjd8qYchzHQ3yz7yIKO8iCWhEkw e9WVr+SYwSWULLEpJ5F/U3uP4UjJeKZaMs7INfxFvjMAZ/GpUsHftawUcreG0piNPo/8 gPMROrRonBlx4TX8YF6vniTmObML/B5g3p0uv7VTk42+TO9oveRzdp6d7W9mMGtCf6yb e/tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428446; x=1716033246; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9nf//qjvXctRXrrQe7LSzMsk4uBFI3ROnap3D79JgrM=; b=ITxyAKCx4ntL6//kM183MRshPcgRaHAdi8SCZ/dHBYOpuO3tsEG2jryc9tmwfMK0V0 qYNFV4kymYy6jdNOPvDexMxBWh/DY4Mi6GF8b+k5iKJpTFm4pgeX4ymS5GcYMSvrpN6C 98nd4acX5IZfXEurKJBEhCsJ1Yn4NsrDrH50VI2UWwx8kT2z016M0kFOQVDQHGfqRh1W YWKSnnwGtgyiYWpLquieArz0wIee/orSV9v/bB3AKty370THef1DwFH+DciSoIuaPNi0 WLcPBkG0dkr3dc7sUBoBvfEtac/5IyBuIZSRjIu8UTEamJSdaX1oaVY+wIAbL+3RiSbA S7vA== X-Gm-Message-State: AOJu0YyW9WNiXpHPDCZzeRY510j+HjTdxEyQeL8VIHykVDh6cPRU8VtZ NIBKn2EiQUdt1jHwFxwPE7B5cTuCX1w8uc5gbv9Yg+VHiBuGF2OoZasjTtZNmi3G6N27UDqwqlJ 5ZQ8= X-Google-Smtp-Source: AGHT+IF+8GkpA3vizDaIwAYGclTrxGUQMDhyplXGWKFoNL8jR8UEFqf3fW+ZbUvi/ul1u2eYiRSIww== X-Received: by 2002:adf:ef4c:0:b0:349:bccc:a1e7 with SMTP id ffacd0b85a97d-3504a6310c6mr5585423f8f.19.1715428445909; Sat, 11 May 2024 04:54:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 03/17] Standardize reginfo_dump_mismatch printing Date: Sat, 11 May 2024 13:53:46 +0200 Message-Id: <20240511115400.7587-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428604723100002 Content-Type: text/plain; charset="utf-8" Hoist the "master vs apprentice" label to apprentice(), since we will want different labels for dumping. Remove all of the "mismatch" text from reginfo_dump_mismatch -- just print "vs". Signed-off-by: Richard Henderson --- risu.h | 4 ++-- risu.c | 1 + risu_reginfo_aarch64.c | 12 +++++------- risu_reginfo_arm.c | 18 +++++++++--------- risu_reginfo_i386.c | 6 +----- risu_reginfo_loongarch64.c | 11 ++++------- risu_reginfo_m68k.c | 23 +++++++---------------- risu_reginfo_ppc64.c | 25 ++++++++++++------------- risu_reginfo_s390x.c | 18 +++++++----------- 9 files changed, 48 insertions(+), 70 deletions(-) diff --git a/risu.h b/risu.h index 2c43384..1b87af2 100644 --- a/risu.h +++ b/risu.h @@ -123,8 +123,8 @@ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r= 2); /* print reginfo state to a stream, returns 1 on success, 0 on failure */ int reginfo_dump(struct reginfo *ri, FILE * f); =20 -/* reginfo_dump_mismatch: print mismatch details to a stream, ret nonzero= =3Dok */ -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f); +/* reginfo_dump_mismatch: print mismatch details to a stream */ +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f); =20 /* return size of reginfo */ int reginfo_size(struct reginfo *ri); diff --git a/risu.c b/risu.c index 6b6295c..9c31b8c 100644 --- a/risu.c +++ b/risu.c @@ -448,6 +448,7 @@ static int apprentice(void) reginfo_dump(&ri[MASTER], stderr); fprintf(stderr, "apprentice reginfo:\n"); reginfo_dump(&ri[APPRENTICE], stderr); + fprintf(stderr, "mismatch detail (master : apprentice):\n"); reginfo_dump_mismatch(&ri[MASTER], &ri[APPRENTICE], stderr); return EXIT_FAILURE; =20 diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 1244454..da221d5 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -275,15 +275,15 @@ int reginfo_dump(struct reginfo *ri, FILE * f) return !ferror(f); } =20 -/* reginfo_dump_mismatch: print mismatch details to a stream, ret nonzero= =3Dok */ -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) { int i; - fprintf(f, "mismatch detail (master : apprentice):\n"); + if (m->faulting_insn !=3D a->faulting_insn) { - fprintf(f, " faulting insn mismatch %08x vs %08x\n", + fprintf(f, " faulting insn: %08x vs %08x\n", m->faulting_insn, a->faulting_insn); } + for (i =3D 0; i < 31; i++) { if (m->regs[i] !=3D a->regs[i]) { fprintf(f, " X%-2d : %016" PRIx64 " vs %016" PRIx64 "\n", @@ -342,7 +342,7 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reg= info *a, FILE * f) sve_dump_preg_diff(f, vq, pm, pa); } } - return !ferror(f); + return; } =20 for (i =3D 0; i < 32; i++) { @@ -356,6 +356,4 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reg= info *a, FILE * f) i, mv[1], mv[0], av[1], av[0]); } } - - return !ferror(f); } diff --git a/risu_reginfo_arm.c b/risu_reginfo_arm.c index 85a39ac..221bd8a 100644 --- a/risu_reginfo_arm.c +++ b/risu_reginfo_arm.c @@ -183,32 +183,33 @@ int reginfo_dump(struct reginfo *ri, FILE *f) return !ferror(f); } =20 -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) { int i; - fprintf(f, "mismatch detail (master : apprentice):\n"); =20 if (m->faulting_insn_size !=3D a->faulting_insn_size) { - fprintf(f, " faulting insn size mismatch %d vs %d\n", + fprintf(f, " faulting insn size: %d vs %d\n", m->faulting_insn_size, a->faulting_insn_size); } else if (m->faulting_insn !=3D a->faulting_insn) { if (m->faulting_insn_size =3D=3D 2) { - fprintf(f, " faulting insn mismatch %04x vs %04x\n", + fprintf(f, " faulting insn: %04x vs %04x\n", m->faulting_insn, a->faulting_insn); } else { - fprintf(f, " faulting insn mismatch %08x vs %08x\n", + fprintf(f, " faulting insn: %08x vs %08x\n", m->faulting_insn, a->faulting_insn); } } + for (i =3D 0; i < 16; i++) { if (m->gpreg[i] !=3D a->gpreg[i]) { - fprintf(f, " r%d: %08x vs %08x\n", i, m->gpreg[i], - a->gpreg[i]); + fprintf(f, " r%d: %08x vs %08x\n", i, m->gpreg[i], a->gpreg[i= ]); } } + if (m->cpsr !=3D a->cpsr) { fprintf(f, " cpsr: %08x vs %08x\n", m->cpsr, a->cpsr); } + for (i =3D 0; i < 32; i++) { if (m->fpregs[i] !=3D a->fpregs[i]) { fprintf(f, " d%d: %016llx vs %016llx\n", i, @@ -216,9 +217,8 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reg= info *a, FILE *f) (unsigned long long) a->fpregs[i]); } } + if (m->fpscr !=3D a->fpscr) { fprintf(f, " fpscr: %08x vs %08x\n", m->fpscr, a->fpscr); } - - return !ferror(f); } diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 834b2ed..18d15ca 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -349,14 +349,12 @@ int reginfo_dump(struct reginfo *ri, FILE *f) return !ferror(f); } =20 -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) { int i, j, n, w; uint64_t features; char r; =20 - fprintf(f, "Mismatch (master v apprentice):\n"); - for (i =3D 0; i < NGREG; i++) { if (m->gregs[i] !=3D a->gregs[i]) { assert(regname[i]); @@ -399,6 +397,4 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reg= info *a, FILE *f) i, m->kregs[i], a->kregs[i]); } } - - return !ferror(f); } diff --git a/risu_reginfo_loongarch64.c b/risu_reginfo_loongarch64.c index 09a1eb6..630d6b2 100644 --- a/risu_reginfo_loongarch64.c +++ b/risu_reginfo_loongarch64.c @@ -195,18 +195,17 @@ int reginfo_dump(struct reginfo *ri, FILE * f) return !ferror(f); } =20 -/* reginfo_dump_mismatch: print mismatch details to a stream, ret nonzero= =3Dok */ -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) +/* reginfo_dump_mismatch: print mismatch details to a stream */ +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) { int i; - fprintf(f, "mismatch detail (master : apprentice):\n"); =20 if (m->vl !=3D a->vl) { - fprintf(f, " vl mismatch %08lx vs %08lx\n", m->vl, a->vl); + fprintf(f, " vl : %08lx vs %08lx\n", m->vl, a->vl); } =20 if (m->faulting_insn !=3D a->faulting_insn) { - fprintf(f, " faulting insn mismatch %08x vs %08x\n", + fprintf(f, " insn : %08x vs %08x\n", m->faulting_insn, a->faulting_insn); } /* r2:tp, r3:sp */ @@ -263,6 +262,4 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reg= info *a, FILE * f) } } } - - return !ferror(f); } diff --git a/risu_reginfo_m68k.c b/risu_reginfo_m68k.c index e29da84..18ae1d8 100644 --- a/risu_reginfo_m68k.c +++ b/risu_reginfo_m68k.c @@ -118,13 +118,12 @@ int reginfo_dump(struct reginfo *ri, FILE *f) return !ferror(f); } =20 -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) { int i; =20 if (m->gregs[R_PS] !=3D a->gregs[R_PS]) { - fprintf(f, "Mismatch: Register PS\n"); - fprintf(f, "master: [%x] - apprentice: [%x]\n", + fprintf(f, " PS: %08x vs %08x\n", m->gregs[R_PS], a->gregs[R_PS]); } =20 @@ -133,22 +132,18 @@ int reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE * f) continue; } if (m->gregs[i] !=3D a->gregs[i]) { - fprintf(f, "Mismatch: Register %c%d\n", i < 8 ? 'D' : 'A', - i % 8); - fprintf(f, "master: [%x] - apprentice: [%x]\n", m->gregs[i], - a->gregs[i]); + fprintf(f, " %c%d: %08x vs %08x\n", + i < 8 ? 'D' : 'A', i % 8, m->gregs[i], a->gregs[i]); } } =20 if (m->fpregs.f_pcr !=3D a->fpregs.f_pcr) { - fprintf(f, "Mismatch: Register FPCR\n"); - fprintf(f, "m: [%04x] !=3D a: [%04x]\n", + fprintf(f, " FPCR: %04x vs %04x\n", m->fpregs.f_pcr, a->fpregs.f_pcr); } =20 if (m->fpregs.f_psr !=3D a->fpregs.f_psr) { - fprintf(f, "Mismatch: Register FPSR\n"); - fprintf(f, "m: [%08x] !=3D a: [%08x]\n", + fprintf(f, " FPSR: %04x vs %04x\n", m->fpregs.f_psr, a->fpregs.f_psr); } =20 @@ -156,14 +151,10 @@ int reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE * f) if (m->fpregs.f_fpregs[i][0] !=3D a->fpregs.f_fpregs[i][0] || m->fpregs.f_fpregs[i][1] !=3D a->fpregs.f_fpregs[i][1] || m->fpregs.f_fpregs[i][2] !=3D a->fpregs.f_fpregs[i][2]) { - fprintf(f, "Mismatch: Register FP%d\n", i); - fprintf(f, "m: [%08x %08x %08x] !=3D a: [%08x %08x %08x]\n", + fprintf(f, " FP%d: %08x%08x%08x vs %08x%08x%08x\n", i, m->fpregs.f_fpregs[i][0], m->fpregs.f_fpregs[i][1], m->fpregs.f_fpregs[i][2], a->fpregs.f_fpregs[i][0], a->fpregs.f_fpregs[i][1], a->fpregs.f_fpregs[i][2]); } } - - - return !ferror(f); } diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index bbdd63c..486bbf9 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -147,35 +147,35 @@ int reginfo_dump(struct reginfo *ri, FILE * f) return !ferror(f); } =20 -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) { int i; + for (i =3D 0; i < 32; i++) { if (i =3D=3D 1 || i =3D=3D 13) { continue; } - if (m->gregs[i] !=3D a->gregs[i]) { - fprintf(f, "Mismatch: Register r%d\n", i); - fprintf(f, "master: [%lx] - apprentice: [%lx]\n", + fprintf(f, "%*s%d: %016lx vs %016lx\n", + 6 - (1 < 10 ? 1 : 2), "r", i, m->gregs[i], a->gregs[i]); } } =20 if (m->gregs[XER] !=3D a->gregs[XER]) { - fprintf(f, "Mismatch: XER\n"); - fprintf(f, "m: [%lx] !=3D a: [%lx]\n", m->gregs[XER], a->gregs[XER= ]); + fprintf(f, "%6s: %016lx vs %016lx\n", + "xer", m->gregs[XER], a->gregs[XER]); } =20 if (m->gregs[CCR] !=3D a->gregs[CCR]) { - fprintf(f, "Mismatch: Cond. Register\n"); - fprintf(f, "m: [%lx] !=3D a: [%lx]\n", m->gregs[CCR], a->gregs[CCR= ]); + fprintf(f, "%6s: %016lx vs %016lx\n", + "ccr", m->gregs[CCR], a->gregs[CCR]); } =20 for (i =3D 0; i < 32; i++) { if (m->fpregs[i] !=3D a->fpregs[i]) { - fprintf(f, "Mismatch: Register f%d\n", i); - fprintf(f, "m: [%016lx] !=3D a: [%016lx]\n", + fprintf(f, "%*s%d: %016lx vs %016lx\n", + 6 - (i < 10 ? 1 : 2), "f", i, m->fpregs[i], a->fpregs[i]); } } @@ -186,13 +186,12 @@ int reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE *f) m->vrregs.vrregs[i][2] !=3D a->vrregs.vrregs[i][2] || m->vrregs.vrregs[i][3] !=3D a->vrregs.vrregs[i][3]) { =20 - fprintf(f, "Mismatch: Register vr%d\n", i); - fprintf(f, "m: [%x, %x, %x, %x] !=3D a: [%x, %x, %x, %x]\n", + fprintf(f, "%*s%d: %08x%08x%08x%08x vs %08x%08x%08x%08x\n", + 6 - (i < 10 ? 1 : 2), "vr", i, m->vrregs.vrregs[i][0], m->vrregs.vrregs[i][1], m->vrregs.vrregs[i][2], m->vrregs.vrregs[i][3], a->vrregs.vrregs[i][0], a->vrregs.vrregs[i][1], a->vrregs.vrregs[i][2], a->vrregs.vrregs[i][3]); } } - return !ferror(f); } diff --git a/risu_reginfo_s390x.c b/risu_reginfo_s390x.c index 3fd91b9..9c8fcfd 100644 --- a/risu_reginfo_s390x.c +++ b/risu_reginfo_s390x.c @@ -107,34 +107,30 @@ int reginfo_dump(struct reginfo *ri, FILE * f) return !ferror(f); } =20 -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) { int i; =20 if (m->pc_offset !=3D a->pc_offset) { - fprintf(f, "Mismatch: PC offset master: [%016lx] - PC offset appre= ntice: [%016lx]\n", + fprintf(f, " PC : %016lx vs %016lx\n", m->pc_offset, a->pc_offset); } =20 for (i =3D 0; i < 16; i++) { if (m->gprs[i] !=3D a->gprs[i]) { - fprintf(f, "Mismatch: r%d master: [%016lx] - r%d apprentice: [= %016lx]\n", - i, m->gprs[i], i, a->gprs[i]); + fprintf(f, " r%-2d : %016lx vs %016lx\n", + i, m->gprs[i], a->gprs[i]); } } =20 for (i =3D 0; i < 16; i++) { if (*(uint64_t *)&m->fprs[i] !=3D *(uint64_t *)&a->fprs[i]) { - fprintf(f, "Mismatch: f%d master: [%016lx] - f%d apprentice: [= %016lx]\n", - i, *(uint64_t *)&m->fprs[i], - i, *(uint64_t *)&a->fprs[i]); + fprintf(f, " f%-2d : %016lx vs %016lx\n", + i, *(uint64_t *)&m->fprs[i], *(uint64_t *)&a->fprs[i]); } } =20 if (m->fpc !=3D a->fpc) { - fprintf(f, "Mismatch: FPC master: [%08x] - FPC apprentice: [%08x]\= n", - m->fpc, a->fpc); + fprintf(f, " FPC : %08x vs %08x\n", m->fpc, a->fpc); } - - return !ferror(f); } --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428593; cv=none; d=zohomail.com; s=zohoarc; b=OF9F0UjDjKFD/ctdHoJINi12cdAW0JuNQ/pVcqbm6gXOZEEdn/fb+2Ff5Ktbe4FynyB7VBHnZC/2llNn7BUYVFDYdYtIbd22Xcolrpgtn0giwRzxqns4ZVcsJ2sA/1Ns28XVJwWjHZRSK9RLXKBwM+Y3TG8PLIdkQyz3kcMNrCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428593; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3X3XgI50snZLtrZ7HC0OWfW96V7yOplWwRGvCG/f16A=; b=N1y8JE61SX9D/5HIhpQagQ9ytE8SWPy4YjOiNbudDtDkoq+zWgKK7YLN7uU8XPNTufftd2Xc2vvTkEWDpkqOsKGSOQdHsvbZ3bMUKmoaIeIfyxJUa8WzY7RhkAwwTsOncTjLVlI3VxC+953hw+U/3k6W3r5TRaDwXtU09O8ay3M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428593927286.65958440396196; Sat, 11 May 2024 04:56:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIp-0000IK-IU; Sat, 11 May 2024 07:54:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIo-0000HM-67 for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:10 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIm-0006xN-8a for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:09 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-34e0d8b737eso2208509f8f.1 for ; Sat, 11 May 2024 04:54:07 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428447; x=1716033247; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3X3XgI50snZLtrZ7HC0OWfW96V7yOplWwRGvCG/f16A=; b=oy7HA8sTwvYL1PsdUzrbFRMI7a8Ha8FeajpE9YJSLELz4Td8NtGJu1ONBbLLGQ2InN zAkerhVN44JSrmBHF8YOfBavNphAT1l9KBF10xzRrifam07w7uhuWlR6OiHQI8o3WqVt wPxvmLxi0W4gFPuWclEzDcUIBHmihIxenzl5DOdu1t6lH1/OT/DZC6TI4DtsYa7P7Ezo pNV/NM65synx3Z25l+Ac42AHB9EC4lUnv2ooZyfYGg2L0C52ABhVudm4Bom1Kcuo0qpu Jo5/v8YD3awYVdlS1TaQpwdJE6RdutbPaRU+RidGhOhQoSHy3RgzOeQvobRSD9eC9EUJ hXwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428447; x=1716033247; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3X3XgI50snZLtrZ7HC0OWfW96V7yOplWwRGvCG/f16A=; b=SsGj1Zf1e+dArXI46O3gUKxd01rq1OuVYvFR6F+UmP6Ct7Z4B7g1p+ZdK+o7wARCwI 5E82rNyl5nIWemjiV1PfXWV0w0Ip6fVjsLUEbK3I25E/VBB7eMJLS/Nle6L3jQPM7Fss qTDGOPwhc6SiTEPJ/TJDeDpmH9jtf5t7y+NNB9WymgV/AMzxPuJY5nccFbaNdVpXGHYh h441ndNO+ygSauBYW0sVadZYnR5xxmDMWZeNyaydp4p/pubSSe/Yo34R1knr/F96rYkM smGfZND5SjQY6/MO3HhY6hMRYjjZDraNeQl6U0rzeUBePxV3UT4hme3rTW0B59qOCymV 80kA== X-Gm-Message-State: AOJu0Yw9xxsDAJZ/3Vw8yZIgDD54EkiQGaqP3ZDx3yIoFFpX6/mw/GOy 5gm4G4si21pGIbHxSNpXa1BvchLxgCOOfcHn4l/ZcMyfxUQt2oXvv2SbDKw17MLiazzVyk1lFDc bbL0= X-Google-Smtp-Source: AGHT+IHlPmGlJB4Ek5LziByD919uV0aCe4JyvBFsNrP2+MClxLY+3S8+I1TVmYuYxXjh90ZP8bpuLg== X-Received: by 2002:a5d:6a42:0:b0:34d:d5e5:6816 with SMTP id ffacd0b85a97d-35018113161mr6982872f8f.8.1715428446910; Sat, 11 May 2024 04:54:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 04/17] Add --fulldump and --diffdup options Date: Sat, 11 May 2024 13:53:47 +0200 Message-Id: <20240511115400.7587-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428594494100001 Content-Type: text/plain; charset="utf-8" These allow the inspection of the trace files. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- risu.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 102 insertions(+), 15 deletions(-) diff --git a/risu.c b/risu.c index 9c31b8c..c28b4a5 100644 --- a/risu.c +++ b/risu.c @@ -483,23 +483,101 @@ static int apprentice(void) } } =20 -static int ismaster; +static int dump_trace(bool isfull) +{ + RisuResult res; + int tick =3D 0; + + while (1) { + struct reginfo *this_ri; + + this_ri =3D &ri[tick & 1]; + res =3D recv_register_info(this_ri); + + switch (res) { + case RES_OK: + switch (header.risu_op) { + case OP_COMPARE: + case OP_TESTEND: + case OP_SIGILL: + printf("%s: (pc %#lx)\n", op_name(header.risu_op), + (unsigned long)header.pc); + + if (isfull || tick =3D=3D 0) { + reginfo_dump(this_ri, stdout); + } else { + struct reginfo *prev_ri =3D &ri[(tick - 1) & 1]; + + if (reginfo_is_eq(prev_ri, this_ri)) { + /* + * ??? There should never be no change -- at minim= um + * PC should have advanced. But for completeness.= .. + */ + printf("change detail: none\n"); + } else { + printf("change detail (prev : next):\n"); + reginfo_dump_mismatch(prev_ri, this_ri, stdout); + } + } + putchar('\n'); + if (header.risu_op =3D=3D OP_TESTEND) { + return EXIT_SUCCESS; + } + tick++; + break; + + case OP_COMPAREMEM: + /* TODO: Dump 8k of data? */ + /* fall through */ + default: + printf("%s\n", op_name(header.risu_op)); + break; + } + break; + + case RES_BAD_IO: + fprintf(stderr, "I/O error\n"); + return EXIT_FAILURE; + case RES_BAD_MAGIC: + fprintf(stderr, "Unexpected magic number: %#08x\n", header.mag= ic); + return EXIT_FAILURE; + case RES_BAD_SIZE: + fprintf(stderr, "Unexpected payload size: %u\n", header.size); + return EXIT_FAILURE; + case RES_BAD_OP: + fprintf(stderr, "Unexpected opcode: %d\n", header.risu_op); + return EXIT_FAILURE; + default: + fprintf(stderr, "Unexpected recv result %d\n", res); + return EXIT_FAILURE; + } + } +} + +enum { + DO_APPRENTICE, + DO_MASTER, + DO_FULLDUMP, + DO_DIFFDUMP, +}; + +static int operation =3D DO_APPRENTICE; =20 static void usage(void) { fprintf(stderr, - "Usage: risu [--master] [--host ] [--port ] " - "\n\n"); - fprintf(stderr, - "Run through the pattern file verifying each instruction\n"); - fprintf(stderr, "between master and apprentice risu processes.\n\n"); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " --master Be the master (server)\n"); - fprintf(stderr, " -t, --trace=3DFILE Record/playback " TRACE_TYPE " = trace file\n"); - fprintf(stderr, - " -h, --host=3DHOST Specify master host machine (apprentice= only)" - "\n"); - fprintf(stderr, + "Usage: risu [--master|--fulldump|--diffdump]\n" + " [--host ] [--port ] \n" + "\n" + "Run through the pattern file verifying each instruction\n" + "between master and apprentice risu processes.\n" + "\n" + "Options:\n" + " --master Be the master (server)\n" + " --fulldump Dump each record\n" + " --diffdump Dump difference between each record\n" + " -t, --trace=3DFILE Record/playback " TRACE_TYPE " trace fi= le\n" + " -h, --host=3DHOST Specify master host machine\n" " -p, --port=3DPORT Specify the port to connect to/listen o= n " "(default 9191)\n"); if (arch_extra_help) { @@ -511,7 +589,9 @@ static struct option * setup_options(char **short_opts) { static struct option default_longopts[] =3D { {"help", no_argument, 0, '?'}, - {"master", no_argument, &ismaster, 1}, + {"master", no_argument, &operation, DO_MASTER}, + {"fulldump", no_argument, &operation, DO_FULLDUMP}, + {"diffdump", no_argument, &operation, DO_DIFFDUMP}, {"host", required_argument, 0, 'h'}, {"port", required_argument, 0, 'p'}, {"trace", required_argument, 0, 't'}, @@ -519,7 +599,7 @@ static struct option * setup_options(char **short_opts) }; struct option *lopts =3D &default_longopts[0]; =20 - *short_opts =3D "h:p:t:"; + *short_opts =3D "d:h:p:t:"; =20 if (arch_long_opts) { const size_t osize =3D sizeof(struct option); @@ -551,6 +631,7 @@ int main(int argc, char **argv) struct option *longopts; char *shortopts; stack_t ss; + bool ismaster; =20 longopts =3D setup_options(&shortopts); =20 @@ -586,6 +667,8 @@ int main(int argc, char **argv) } } =20 + ismaster =3D operation =3D=3D DO_MASTER; + if (trace) { if (strcmp(trace_fn, "-") =3D=3D 0) { comm_fd =3D ismaster ? STDOUT_FILENO : STDIN_FILENO; @@ -609,6 +692,10 @@ int main(int argc, char **argv) } } =20 + if (operation =3D=3D DO_FULLDUMP || operation =3D=3D DO_DIFFDUMP) { + return dump_trace(operation =3D=3D DO_FULLDUMP); + } + imgfile =3D argv[optind]; if (!imgfile) { fprintf(stderr, "Error: must specify image file name\n\n"); --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428487; cv=none; d=zohomail.com; s=zohoarc; b=PsaMQ74AgfKewXFtxSnys5ipVtk8cYKKbA+3nPk8czfu0/VKicuMR1hSxg45ZRRHutFzoF24hBjVpcV32zBdp9khrxNi29bR0s54X6tvhKM8e2i+J4nGB1HxhlkuNCJz6C9WkIx5YtTg/evNkNDokCqkkCEFfn4urZZ3u1a1xUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428487; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m32BdCDoIDtUZU97rjMJn0R/q9fXLMgEs1BlUjCyWs4=; b=lq1jNAp37AkkNVC3pdnUgWTC4Si5/JHZW7ZZRETeiE27cdF5NTCFfPGpj7rzt+eU4BHqheLANg2D37jsnsWeNSgftVa7gmzTyaXoBiwPorQ5COW0m5fgLMz/Oeg9ey5FtSjZnY1BCFqVkiH14foRcknUlU6kjK78yqGiBRcUkMY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428487460412.30766799527976; Sat, 11 May 2024 04:54:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIq-0000Ie-Oo; Sat, 11 May 2024 07:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIp-0000ID-3n for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:11 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIn-0006xZ-4B for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:10 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-34c8592b8dbso2240539f8f.3 for ; Sat, 11 May 2024 04:54:08 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428447; x=1716033247; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m32BdCDoIDtUZU97rjMJn0R/q9fXLMgEs1BlUjCyWs4=; b=oB1R5M0vWv1DO3FldvS07YuNfuU8aeyfYlmwc9TB1F9yOgj1Jz1bAf9bhnemvzR6wG OV1Sq5KWa3TlENtTuV5eAEkd9fqL+RublvRK2cEOvQD/UiXkvPaptMuJDn2xRHwkTxK4 Yp1Nxl9ptHCuRF5lbZGCATDXaHF8XZ85b9GvFIOUchBcb/c0W7EiRBDCCXGwpVILsFJL BBJrY0nS7an44P6X3ENm7BedLmye3a7mbO2J0jFzBQrOoY4cp1OUNRxdmo/7zYR7uRak WmGZhNE8eAbrX2ZFMHdt6lOgqcCPegVh7tkl+r3an55hiHA5rBraB3biDpUbtn+lCGDm a3zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428447; x=1716033247; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m32BdCDoIDtUZU97rjMJn0R/q9fXLMgEs1BlUjCyWs4=; b=HUtbRPihMnERShIcp+gppwSKG+0+ipcWNhsH+BiafaMogJvHxeMHiDjFeeppUUNtWh 2uBJi4cqlH3sKLHjbGyDYZEwNKuAnLv/GKEwqoyPTXVHwa9ZOzkuNek/DhDdMZ56EbLv uZauVKTUmrBYI9WrTSjWvjJgciu1lQ36HjIgcpYUfkfTb95WXMkn8OpvqeTfb2rkxls4 6nEHr2pz6Tn2pGj1ERAm+MhobF+0f1LsG3O0qXOkPZ4hF86rToqzv5/vx5FBgBlWnJ+h LclCzdOXXpyGjkn7GuB0FnoTFetFaa6UusHB67GLwDFyA9CuiP18ug29/q1M7ir9PBxr k3dg== X-Gm-Message-State: AOJu0YxxL5K39RBbfpQnvJbBxbjkBQZWNzcU69SIvYs4FSTIN9NEbIfb v6KS9+2PBG30VMbsb+rbOixc5gMOHG5ggy1rVNkfjiquK969dkpNsTzXlzlPkBpj2Ar50MMd/np 8IbU= X-Google-Smtp-Source: AGHT+IHZMnFpf1Y2GHDVTd0LeF1e7fmOTek+tFrCz8wth4peVTgG+6xjpJnG9VN+1AZ/GMor4fffag== X-Received: by 2002:a5d:698d:0:b0:34b:2a61:b3c9 with SMTP id ffacd0b85a97d-3504a73ece6mr3512221f8f.40.1715428447727; Sat, 11 May 2024 04:54:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 05/17] Remove return value from reginfo_dump Date: Sat, 11 May 2024 13:53:48 +0200 Message-Id: <20240511115400.7587-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428488448100003 Content-Type: text/plain; charset="utf-8" No uses actually checked the error indication. Even if we wanted to check ferror on the stream, we should do that generically rather than per arch. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu.h | 4 ++-- risu_reginfo_aarch64.c | 8 +++----- risu_reginfo_arm.c | 6 ++---- risu_reginfo_i386.c | 6 ++---- risu_reginfo_loongarch64.c | 6 ++---- risu_reginfo_m68k.c | 6 ++---- risu_reginfo_ppc64.c | 6 ++---- risu_reginfo_s390x.c | 6 ++---- 8 files changed, 17 insertions(+), 31 deletions(-) diff --git a/risu.h b/risu.h index 1b87af2..aa8cc22 100644 --- a/risu.h +++ b/risu.h @@ -120,8 +120,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr); /* return 1 if structs are equal, 0 otherwise. */ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2); =20 -/* print reginfo state to a stream, returns 1 on success, 0 on failure */ -int reginfo_dump(struct reginfo *ri, FILE * f); +/* print reginfo state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE *f); =20 /* reginfo_dump_mismatch: print mismatch details to a stream */ void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f); diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index da221d5..0161044 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -219,8 +219,8 @@ static void sve_dump_zreg_diff(FILE *f, int vq, const u= int64_t *za, } } =20 -/* reginfo_dump: print state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE * f) +/* reginfo_dump: print state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE * f) { int i; fprintf(f, " faulting insn %08x\n", ri->faulting_insn); @@ -263,7 +263,7 @@ int reginfo_dump(struct reginfo *ri, FILE * f) sve_dump_preg(f, vq, p); fprintf(f, "\n"); } - return !ferror(f); + return; } =20 for (i =3D 0; i < 32; i++) { @@ -271,8 +271,6 @@ int reginfo_dump(struct reginfo *ri, FILE * f) fprintf(f, " V%-2d : %016" PRIx64 "%016" PRIx64 "\n", i, v[1], v[0]); } - - return !ferror(f); } =20 void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) diff --git a/risu_reginfo_arm.c b/risu_reginfo_arm.c index 221bd8a..0e179be 100644 --- a/risu_reginfo_arm.c +++ b/risu_reginfo_arm.c @@ -161,8 +161,8 @@ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r= 2) return memcmp(r1, r2, sizeof(*r1)) =3D=3D 0; /* ok since we memset = 0 */ } =20 -/* reginfo_dump: print the state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE *f) +/* reginfo_dump: print the state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE *f) { int i; if (ri->faulting_insn_size =3D=3D 2) { @@ -179,8 +179,6 @@ int reginfo_dump(struct reginfo *ri, FILE *f) i, (unsigned long long) ri->fpregs[i]); } fprintf(f, " fpscr: %08x\n", ri->fpscr); - - return !ferror(f); } =20 void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 18d15ca..f4cf9a3 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -310,8 +310,8 @@ static char get_vecletter(uint64_t features) } } =20 -/* reginfo_dump: print state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE *f) +/* reginfo_dump: print state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE *f) { uint64_t features; int i, j, n, w; @@ -345,8 +345,6 @@ int reginfo_dump(struct reginfo *ri, FILE *f) fprintf(f, " k%-5d: %016" PRIx64 "\n", i, ri->kregs[i]); } } - - return !ferror(f); } =20 void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) diff --git a/risu_reginfo_loongarch64.c b/risu_reginfo_loongarch64.c index 630d6b2..060715f 100644 --- a/risu_reginfo_loongarch64.c +++ b/risu_reginfo_loongarch64.c @@ -159,8 +159,8 @@ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r= 2) return !memcmp(r1, r2, sizeof(*r1)); } =20 -/* reginfo_dump: print state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE * f) +/* reginfo_dump: print state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE * f) { int i; fprintf(f, " faulting insn %08x\n", ri->faulting_insn); @@ -191,8 +191,6 @@ int reginfo_dump(struct reginfo *ri, FILE * f) fprintf(f, " vreg%-2d : %016lx\n", i, ri->vregs[4 * i]); } } - - return !ferror(f); } =20 /* reginfo_dump_mismatch: print mismatch details to a stream */ diff --git a/risu_reginfo_m68k.c b/risu_reginfo_m68k.c index 18ae1d8..a53244d 100644 --- a/risu_reginfo_m68k.c +++ b/risu_reginfo_m68k.c @@ -92,8 +92,8 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) return 1; } =20 -/* reginfo_dump: print state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE *f) +/* reginfo_dump: print state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE *f) { int i; fprintf(f, " pc \e[1;101;37m0x%08x\e[0m\n", ri->pc); @@ -114,8 +114,6 @@ int reginfo_dump(struct reginfo *ri, FILE *f) } =20 fprintf(f, "\n"); - - return !ferror(f); } =20 void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index 486bbf9..fc69805 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -103,8 +103,8 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) return 1; } =20 -/* reginfo_dump: print state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE * f) +/* reginfo_dump: print state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE * f) { int i; =20 @@ -143,8 +143,6 @@ int reginfo_dump(struct reginfo *ri, FILE * f) ri->vrregs.vrregs[i][0], ri->vrregs.vrregs[i][1], ri->vrregs.vrregs[i][2], ri->vrregs.vrregs[i][3]); } - - return !ferror(f); } =20 void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) diff --git a/risu_reginfo_s390x.c b/risu_reginfo_s390x.c index 9c8fcfd..cbf168e 100644 --- a/risu_reginfo_s390x.c +++ b/risu_reginfo_s390x.c @@ -82,8 +82,8 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) memcmp(&m->fprs, &a->fprs, sizeof(m->fprs)) =3D=3D 0; } =20 -/* reginfo_dump: print state to a stream, returns nonzero on success */ -int reginfo_dump(struct reginfo *ri, FILE * f) +/* reginfo_dump: print state to a stream */ +void reginfo_dump(struct reginfo *ri, FILE * f) { int i; =20 @@ -103,8 +103,6 @@ int reginfo_dump(struct reginfo *ri, FILE * f) i + 8, *(uint64_t *)&ri->fprs[i + 8]); } fprintf(f, "\tFPC: %8x\n\n", ri->fpc); - - return !ferror(f); } =20 void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428575; cv=none; d=zohomail.com; s=zohoarc; b=VMxlsPDerBAOjIraqkUA/LXbqRiI0tNlsbAte7YGdJWTdY1YByTn+yPXNRPMCO0ti1dFZnNOAex3EAGhZoDbUGgyYolNO1b1z6WKkQOJ/4YPJousggsQLQKwmGkrZ5FDctW/u7v4wpg3s18Yyz/HmArYF0KaETYTy+jfZ7jwtMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428575; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; b=QjN8VIEpqop0064/0m68deakY8nKtZeNDmpT7yqUa4GqF11F51HTiXnEgODFxZPqePwDlJ5sQykKahDEsJp35n6T2dK54b+shkVVKSa7osJAOWVUFC/Nmq0OoeeWxZxwJ4i94h2ngRLAvZnvPYRAytVk4LV7C3Sx8QQUFskYjKA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428574857755.5810242402196; Sat, 11 May 2024 04:56:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIr-0000JJ-E4; Sat, 11 May 2024 07:54:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIp-0000IO-Sx for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:11 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIo-0006xn-1L for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:11 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-34db6a29998so2132056f8f.0 for ; Sat, 11 May 2024 04:54:09 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428448; x=1716033248; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; b=C3i/Sm8L8fgcpfcGbXbup/T+72Vh1BcR7CdYP7UPkDqhSodM3sA2bLfKhgq/bXRS4i Esy3X+PASjmGBkTM6rKo5UTSuUZUdUpcEh8hQ/f9Ht1fS9lwQdx44yW7O4amMayv/cBG 7A2t9ASX/FHO5O7x4RYoOGZMYeyaHfB1AMIbPC0zs9hjzjPHgYLclGNDKE3LHYzbX2VJ lCenVMlNV7Edw3Eb9rFQEnbAmJjosPfV8E66jwSjAGvCBhtJkhZbLrdHZGT8dpq5HsjC To72mLEKqi5TP19kIGwrv/vHtx3EtlzcxQzoXl5FO2U+3waN3QjlqgSuDcEveT7zqcug RFNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428448; x=1716033248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; b=QUekZzpiceJAwlzl6gjeo54vtVjoO2coHTTt7tIBCMmjtuixg0X1gEWagzaqrNXN4M 0nQpjOrgh17mUba3MqkDAdW53N+tFYc9+n45HEHhQJIFT4/FxiFiBhc4a+XN72TDBYlz UvKt4bC8j4dOB9uYn2fFeW2vHlKcR1jXtSzQTEu7+Z24ombZJ+om/uMsptYbBD2hSV8l 3iQXyt2HZ0SD8oyfey5jyGBEPs+STt1K5iNzAULC4wxS3lWd5KCTHSdjD93dk8kAS9Ko e2j1Gj8gAlYrS4fB5KzmTlP6xZlgIAJtEsBEtOBcqBcQeN0g1h+OHtG6gz7aNEwG0M/a 0PJA== X-Gm-Message-State: AOJu0YyXhkfCRCeYZrCrnSxvE30Paloev8vWKC9ik1vjqGplnkvpewAY HbnNDF1ioEgNZfInQ4/RIo4opvh7sAhcb6pmJLTOFzLaMEQP9KLGeMIH8ZlVIXakSjh+GyeSjW2 Rmnw= X-Google-Smtp-Source: AGHT+IGx8YpfbvnPnWHEJERLk/6K4MJFluddbQifr6adM54r+UsZr/q96TL9w3O1eyszFA7uP8tJug== X-Received: by 2002:adf:ec4d:0:b0:343:7b6b:dcc6 with SMTP id ffacd0b85a97d-3504a73bc6amr3813189f8f.30.1715428448496; Sat, 11 May 2024 04:54:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 06/17] ppc64: Clean register values in reginfo_init Date: Sat, 11 May 2024 13:53:49 +0200 Message-Id: <20240511115400.7587-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428576397100003 Content-Type: text/plain; charset="utf-8" Smash the stack and thread pointers to deadbeef, as is common for the other architectures. This allows us to drop these special cases within reginfo_is_eq and reginfo_dump_mismatch. Do not copy the unused special registers that are packed into gregs[]. Most of these are related to system instructions and thus are not manipulable via the user-mode instructions targeted by RISU. LNK and CTR are not initialized by risugen, and since in general we cannot test branches with risugen these can be ignored. This leaves only XER and CCR as the only special registers to be copied. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu_reginfo_ppc64.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index fc69805..67ea3ce 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -44,16 +44,16 @@ int reginfo_size(struct reginfo *ri) /* reginfo_init: initialize with a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr) { - int i; - memset(ri, 0, sizeof(*ri)); =20 ri->faulting_insn =3D *((uint32_t *) uc->uc_mcontext.regs->nip); ri->nip =3D uc->uc_mcontext.regs->nip - image_start_address; =20 - for (i =3D 0; i < NGREG; i++) { - ri->gregs[i] =3D uc->uc_mcontext.gp_regs[i]; - } + memcpy(ri->gregs, uc->uc_mcontext.gp_regs, 32 * sizeof(ri->gregs[0])); + ri->gregs[1] =3D 0xdeadbeefdeadbeef; /* sp */ + ri->gregs[13] =3D 0xdeadbeefdeadbeef; /* tp */ + ri->gregs[XER] =3D uc->uc_mcontext.gp_regs[XER]; + ri->gregs[CCR] =3D uc->uc_mcontext.gp_regs[CCR]; =20 memcpy(ri->fpregs, uc->uc_mcontext.fp_regs, 32 * sizeof(double)); ri->fpscr =3D uc->uc_mcontext.fp_regs[32]; @@ -69,10 +69,6 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) { int i; for (i =3D 0; i < 32; i++) { - if (i =3D=3D 1 || i =3D=3D 13) { - continue; - } - if (m->gregs[i] !=3D a->gregs[i]) { return 0; } @@ -150,9 +146,6 @@ void reginfo_dump_mismatch(struct reginfo *m, struct re= ginfo *a, FILE *f) int i; =20 for (i =3D 0; i < 32; i++) { - if (i =3D=3D 1 || i =3D=3D 13) { - continue; - } if (m->gregs[i] !=3D a->gregs[i]) { fprintf(f, "%*s%d: %016lx vs %016lx\n", 6 - (1 < 10 ? 1 : 2), "r", i, --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428560; cv=none; d=zohomail.com; s=zohoarc; b=J31Hen0sSRj3NocSYZ9VFyOHYNyUDk117csM+b7FadJ2zOmaTeoT+ZlphjC/KyCP2y8CRXjZkmcv6QkcXb00jXY+3o/40WZAaktG8Mpu8JSczmQ64GYhZe5gFryJBRuT23au6rpN8ZUEml2/3H9VBa0+fRjiecmxu4u6U6CMQtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428560; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fK+33hG7y7qtK+XmeBcuCbI8Hmdt6nSy4YCvnmn+BlU=; b=MG6pzAC30gtucZciiehwZbEFr1YXgCt2hENzH7aJ4JzeUl08fMu8SG4qFiaZuxh9M3cbZg+aQnb2pHkvR4w8HF03XwZYj/dHM04MVwtco5C/2dffeln2NOujrra+a0y1XE+iC/LgDtJFbRBl277rk2I+rwK796307J3R/4UaL0o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428560633895.8165376846359; Sat, 11 May 2024 04:56:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIs-0000Jw-6O; Sat, 11 May 2024 07:54:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIq-0000Ib-Ip for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:12 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIo-0006y1-Md for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:12 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-34e28e32ea4so1740610f8f.2 for ; Sat, 11 May 2024 04:54:10 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428449; x=1716033249; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fK+33hG7y7qtK+XmeBcuCbI8Hmdt6nSy4YCvnmn+BlU=; b=wSlsbqcJBeruehim4alPKMSxmRDPdzNo36p22Fnkh/03yF+DgOG0PoyvEBKsLpsKG2 xfVVuYdzUSGkrWUT8VjmI3uRCSHKYvj/lQARa42tEtE7cVs6VzYEAfkeiNvmshAiFmi8 5vJFmPHJH91+m1ReXyCDYC2MwbRbL/n8Alv6KyUFbpNZXnBg8CIDPzKVS5OJtxdr4wmt 71n/WO3bFKnl+Q6FuvWRNHy1JF4DnCPRr6SZf5deah0zfDjOBVpnAvfioSj16l9ALz51 pGe5iZKvJGkPDAgsbV8lNm3UUraAuMcf4iv/qj0+Uwi9H09r+GLlRK7rVNlreb8Rwc5T IdRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428449; x=1716033249; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fK+33hG7y7qtK+XmeBcuCbI8Hmdt6nSy4YCvnmn+BlU=; b=KTfFUWCF2gspDTTlTCEFARW4Ig+J0uBRObl1l5v8Qch2I1dmz0y2ZSXENmmsvC/s8O vXyFv0KTppJm9lFnjXkLvIuiYZXnPadSfi7IYkmNwUlS07L8JoNgwLfqEbJkezXr9UA1 SDiFQC4sD75atGumzCG1BqdAaWvt8FIvxKPMdBiyDlwHb3oalvos+gwfpHQh0s8Yjasq VGO7njMyXgkYXg/qyyjjLgZRG0NyyG49TUWKAmhemwGXx5stEAv3FH4Oholk1+HApipI zSPIRuPLDoeFSlLYaQS/s8yos0RksRzTNV1H+6Hnx51oNqmCFVljgJxtfmSTJJ0uU2kw RM/A== X-Gm-Message-State: AOJu0Yx8Q5IG3TH6inPa619893usrak2lKv6KXF7ejbqTSpXOVPuDVbI k8fTB0pBXKdvTJ1CbhooEJQ3Sr8pk5AqHnO8eUMrJDtnvwcIzwzbuffPkaMtauwYStn8IBx5aBD JN+Q= X-Google-Smtp-Source: AGHT+IHgPt8H57AZtUUsJVQpox8VPsFKvhnx6y5anFqpzcG83pYyyf81tylHlg+AyHZaIX5Mj/VZLg== X-Received: by 2002:a5d:4b0d:0:b0:345:c1cc:2d85 with SMTP id ffacd0b85a97d-3504a96a6femr3911614f8f.55.1715428449366; Sat, 11 May 2024 04:54:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 07/17] ppc64: Compare all bits of CCR Date: Sat, 11 May 2024 13:53:50 +0200 Message-Id: <20240511115400.7587-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428562303100009 Content-Type: text/plain; charset="utf-8" There are 32 bits in this register, and they are all valid comparision destinations. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu_reginfo_ppc64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index 67ea3ce..109b87b 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -78,7 +78,7 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) return 0; } =20 - if ((m->gregs[CCR] & 0x10) !=3D (a->gregs[CCR] & 0x10)) { + if (m->gregs[CCR] !=3D a->gregs[CCR]) { return 0; } =20 --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428596; cv=none; d=zohomail.com; s=zohoarc; b=C4Z1RlpgNDA8vBacbdDZ5PFOpV6z0ngiR34JZOmAreT2UhA3aFUUER7N93VWkHNOI1HKPYfslLiuzFeSTD0NCVrSCD5KnXGFAOYWLYsrySNt+IL5Jys1nGonhjpZIn8Zsp5n5uHn116/dcquhu3d1UXkzBWuBAjoemsDZA9NNPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428596; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AMtGB7SdOO69qhWqUoEC0VG8+kqB1EisNhBCOHuP3kg=; b=DVHoKIWvF4u6K23fPbMUul/drXKxS7scIOm7A3X9eIlaPz0+XZutQbGhC3/Gz8rIGnCyT1ukzkhqmbTQkucbRHt5XCyadZCa6b6Vhga5al/8+oZ9l7tqEMateeBiHGeJsRnDAKEeTcHOpduq82kt9JppcoeOKDc8HZAmjKcIllo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428596532917.320748451191; Sat, 11 May 2024 04:56:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIt-0000KO-FD; Sat, 11 May 2024 07:54:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIr-0000JN-Ms for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:13 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIp-0006yS-Ql for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:13 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3504f34a086so1337674f8f.1 for ; Sat, 11 May 2024 04:54:11 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428450; x=1716033250; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AMtGB7SdOO69qhWqUoEC0VG8+kqB1EisNhBCOHuP3kg=; b=mUPRLVI6FX5E0XkZkpwku1p+C8OVUBr6373mCqg8W6Txv/t8rTjU1jlWk0xZLeEGAo YU9m97BAEKKdNYHN0JJ8hxY6ksi1r+77vDqSX0Zj/BXqGznNSiA+m78KKnH0/vPYnbC9 s4iptqU44iYejg+EMyhIgTJWtoOUsGOrmSbahogtdqk9V6gEtfAKHD0p0njpOJr9Slqk PW51YwI9qaP6RIaDnOVIX73/0UJS1G0S9jL4BPqVCJ2jjI5kuPJmKeXFzhLp6/ydLyOX XeM+GezaYvyEnovEaH2GEGJw8tOD6jtw2aT7aamkR1s43/pK+Uvdq9QRvTqz3QzjbdZT FZ6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428450; x=1716033250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AMtGB7SdOO69qhWqUoEC0VG8+kqB1EisNhBCOHuP3kg=; b=SYS8MQ+psxHkCoVjpiLQWH0EvHsR98RQklGaOtuLQp86ZTsy7xKPw9uksm6Mbur94n Ti08YUxQQCUkTMDpoc9J2hBGFX8UwOGAnu/xN9MOdwFS3HbeOJi0fyj/E+WO+dDey3DX qMC8L/gDvAUL2NF/12fLV2cXVdwcCgaMrAP0VCn2pOO5VthKl8yogW5EWIn3VASZEDOi UE9NlQ5DN8H/XmSRZdYpLCI4sYiCQtqP+a8mkBn5JzpwK9lnNmI9K7lCWfm6KzCgcpqy qX+zgDugx/fS6HfxyyuZ3pploeC+Efee+zZVa1hfiHO3bBk0Xu3X/465YGvo94AZvkdg a0pA== X-Gm-Message-State: AOJu0YxJ8KAdd+l5zaKH40trxrmfutmVBsxkEeyxWVvIBvK4DJsuBiWk y9aDDbwVNH37/TKuq5ODvAuJGXTKFs/ZCVliXNzgnT/kDQ5Kn13uQZ+7yvzO92pQ6+strXeVKQI Xznw= X-Google-Smtp-Source: AGHT+IFYdfEMVbDqUwGL9dZZEosJ0J9+/IiaKIhl6shyMkoeI3hlio74PUAs5QhGAbZ/7LiQXAK2gA== X-Received: by 2002:adf:f8c4:0:b0:34c:6677:b7de with SMTP id ffacd0b85a97d-3504a632e11mr3986688f8f.2.1715428450334; Sat, 11 May 2024 04:54:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 08/17] ppc64: Simplify reginfo_is_eq Date: Sat, 11 May 2024 13:53:51 +0200 Message-Id: <20240511115400.7587-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428598461100007 Content-Type: text/plain; charset="utf-8" Since we now only copy into reginfo exactly what we want to compare, and since we zero all unused padding and reserved space, we need not enumerate each field for comparison, but defer to memcmp. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu_reginfo_ppc64.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index 109b87b..e0c650b 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -67,36 +67,7 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, vo= id *siaddr) /* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) { - int i; - for (i =3D 0; i < 32; i++) { - if (m->gregs[i] !=3D a->gregs[i]) { - return 0; - } - } - - if (m->gregs[XER] !=3D a->gregs[XER]) { - return 0; - } - - if (m->gregs[CCR] !=3D a->gregs[CCR]) { - return 0; - } - - for (i =3D 0; i < 32; i++) { - if (m->fpregs[i] !=3D a->fpregs[i]) { - return 0; - } - } - - for (i =3D 0; i < 32; i++) { - if (m->vrregs.vrregs[i][0] !=3D a->vrregs.vrregs[i][0] || - m->vrregs.vrregs[i][1] !=3D a->vrregs.vrregs[i][1] || - m->vrregs.vrregs[i][2] !=3D a->vrregs.vrregs[i][2] || - m->vrregs.vrregs[i][3] !=3D a->vrregs.vrregs[i][3]) { - return 0; - } - } - return 1; + return memcmp(m, a, sizeof(*m)) =3D=3D 0; } =20 /* reginfo_dump: print state to a stream */ --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428597; cv=none; d=zohomail.com; s=zohoarc; b=E4YBbTKhRzYKH0t7JdYsealI1R01FfAu1gBFr1aGUD6DqzNJI02swIxaypVQZd9GMcJgUkMGN772t1WQpt/5Q3PPXWUmpmOAVmxZm788UqpMA01iMTTxshElU1TJnNrtBusm+YYT9HMamzhPWTgjupD9ftseVApSEaOJ5KBG8gE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428597; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M2krjFClQtt6ewuvoLiaCYVCPhv1mkrudW+d9ZYqpvE=; b=IkJvVQFErVYMuGnHtua5mJ5XuUjOwx8XoRFak+xUsNPgHKwVA4fdO7RQKKMz88y9YP2hsquEySEGbGGedFg1nD43/EOI9GfnF7hxtqg+IztrULa7kT+HjSJRoABUcBDOHbkPuysbquG1gmNhRAakxGSDNCMszW77AddhZT0yqgM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428597844263.16658509456033; Sat, 11 May 2024 04:56:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIu-0000Kz-Rv; Sat, 11 May 2024 07:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIt-0000KB-6m for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:15 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIr-0006ym-GR for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:14 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-51fc01b6fe7so2986530e87.0 for ; Sat, 11 May 2024 04:54:13 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428451; x=1716033251; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M2krjFClQtt6ewuvoLiaCYVCPhv1mkrudW+d9ZYqpvE=; b=OuDha/HbAEvMAA/AZ4WjmBozPBkAaxl+vOZP+yE0egI0+VhUriHSSm797fzs2RJUd+ XohqjRmbDRVl6Ze8YVQc8GkL5W3xsTiizV5RRfCDNc0M1FtHy05FazIa/Dj//XSz1nrM 46EvoVA0bsbd0wB2uTKXVeHEGqK7wEAk8deHPgc3uyO64nuMXU73307U1MTYexqVS8MB kUPj6N9i4PD8L/nWy9d1qF+K+Vhq36FH2H0wN004zZNp/35wUz9DZnPS87xEMeWMFdGF UcW3QvIf71N+4QmkPhf5o1Z0QrvoQnRESY9UEVjpPKayOGym6Hse/q3Fp0egvuiKk/zm NBBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428451; x=1716033251; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M2krjFClQtt6ewuvoLiaCYVCPhv1mkrudW+d9ZYqpvE=; b=KJ37eT8JqqOTjbINpJ8KT1XOqU27Ldg6ZSv6ex/wVx9Curz2/pd5xALW6Yh720xLDc rFrOEpIvTDxuIfmIaTzyQPNIYDkXPaWprhmfhGj4S7uXJsDh4KX71h8K/gHbtlQqyCqV vlHaw/5ZqrVq4VJFYSzW4iPlF+trMK9MS/ShooLqijgquSmUk9VkYGGRY40EyAzKx6q/ taV3rNIlj87IPpFeLfvXA0Lc2wDpRuYnS6KfnUcrDp1BSA1J4nynyxl0um1o2lLRZA6Q Gsil/9br9t6gRQcxsyoGqGZ9yY1cfkyHC/Eg1DMervl2MkMMyXlVUWd4dDSBT+LRrwqP FmBA== X-Gm-Message-State: AOJu0YyD+t/RPZrGioCwKmsO3gDna9zqhZPWTXZdK3Gctux4gpyw4ZrB 9TGuoNPP1tY2/EQLdNNeNcL5RQywtDcwXq8M7bkm6bEs8oV5DdVLE29xJiGJudpYiYxSb5JPd+L Rws4= X-Google-Smtp-Source: AGHT+IG6l7v4tIhLFQzBgJn9n8SIws77LlPkOfBOoN8fvoy1RRLSV2j0oMlilu5Mn1fgv1j34oKzhA== X-Received: by 2002:ac2:4831:0:b0:51d:38ee:ddda with SMTP id 2adb3069b0e04-5221057932amr3200192e87.52.1715428451509; Sat, 11 May 2024 04:54:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 09/17] ppc64: Clean up reginfo_dump Date: Sat, 11 May 2024 13:53:52 +0200 Message-Id: <20240511115400.7587-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x130.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428598481100008 Content-Type: text/plain; charset="utf-8" Dump only the registers that we copied in reginfo_init. Improve the formatting and layout of what we do dump. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu_reginfo_ppc64.c | 51 ++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index e0c650b..730a565 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -75,38 +75,29 @@ void reginfo_dump(struct reginfo *ri, FILE * f) { int i; =20 - fprintf(f, " faulting insn 0x%x\n", ri->faulting_insn); - fprintf(f, " prev insn 0x%x\n", ri->prev_insn); - fprintf(f, " prev addr 0x%" PRIx64 "\n\n", ri->nip); - - for (i =3D 0; i < 16; i++) { - fprintf(f, "\tr%2d: %16lx\tr%2d: %16lx\n", i, ri->gregs[i], - i + 16, ri->gregs[i + 16]); - } - - fprintf(f, "\n"); - fprintf(f, "\tnip : %16lx\n", ri->gregs[32]); - fprintf(f, "\tmsr : %16lx\n", ri->gregs[33]); - fprintf(f, "\torig r3: %16lx\n", ri->gregs[34]); - fprintf(f, "\tctr : %16lx\n", ri->gregs[35]); - fprintf(f, "\tlnk : %16lx\n", ri->gregs[36]); - fprintf(f, "\txer : %16lx\n", ri->gregs[37]); - fprintf(f, "\tccr : %16lx\n", ri->gregs[38]); - fprintf(f, "\tmq : %16lx\n", ri->gregs[39]); - fprintf(f, "\ttrap : %16lx\n", ri->gregs[40]); - fprintf(f, "\tdar : %16lx\n", ri->gregs[41]); - fprintf(f, "\tdsisr : %16lx\n", ri->gregs[42]); - fprintf(f, "\tresult : %16lx\n", ri->gregs[43]); - fprintf(f, "\tdscr : %16lx\n\n", ri->gregs[44]); - - for (i =3D 0; i < 16; i++) { - fprintf(f, "\tf%2d: %016lx\tf%2d: %016lx\n", i, ri->fpregs[i], - i + 16, ri->fpregs[i + 16]); - } - fprintf(f, "\tfpscr: %016lx\n\n", ri->fpscr); + fprintf(f, "%6s: %08x\n", "insn", ri->faulting_insn); + fprintf(f, "%6s: %016lx\n", "pc", ri->nip); =20 for (i =3D 0; i < 32; i++) { - fprintf(f, "vr%02d: %8x, %8x, %8x, %8x\n", i, + fprintf(f, "%*s%d: %016lx%s", + 6 - (i < 10 ? 1 : 2), "r", i, ri->gregs[i], + i & 1 ? "\n" : " "); + } + + fprintf(f, "%6s: %016lx %6s: %016lx\n", + "xer", ri->gregs[XER], + "ccr", ri->gregs[CCR]); + + for (i =3D 0; i < 32; i++) { + fprintf(f, "%*s%d: %016lx%s", + 6 - (i < 10 ? 1 : 2), "f", i, ri->fpregs[i], + i & 1 ? "\n" : " "); + } + fprintf(f, "%6s: %016lx\n", "fpscr", ri->fpscr); + + for (i =3D 0; i < 32; i++) { + fprintf(f, "%*s%d: %08x %08x %08x %08x\n", + 6 - (i < 10 ? 1 : 2), "vr", i, ri->vrregs.vrregs[i][0], ri->vrregs.vrregs[i][1], ri->vrregs.vrregs[i][2], ri->vrregs.vrregs[i][3]); } --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428679; cv=none; d=zohomail.com; s=zohoarc; b=Iw0H+HLId08olk+gWlkmbW+zhVTFAEbY8jOPf1XasYPGu1OnGSkAUCwirDbuygj0sB9u36VMldGjhzAAoVYasPv0yIytH7W1JMZEgyZuE8b/Tte1lc2lB4uTuuhGMT5ltVf0EdIR405mpPY8Y687ep051R8GesF4U1juadDGDD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428679; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cCWM57OHz2JIAYU8qBsg/sKiTEv/cPu3ovotF6RL+Z8=; b=lgbeQuBKY6st9+fl5Xy7yoMegdC0vQo6zihtuzHd87FVXakRiPGrl4BkrAPN0iD93ILrbCcVzmuWU9oJT3/+9wbysfBWjMinLKKAWLrxx6pz6n+KgEkTjwCgeyIsUpB91yZmNetAM0fIodHryhq0G1MIqS3hBzSJaF+pTphogS8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428679030125.44761476170697; Sat, 11 May 2024 04:57:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIv-0000LY-IG; Sat, 11 May 2024 07:54:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIu-0000Ko-Aw for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:16 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIs-0006yx-5a for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:15 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2e09138a2b1so36033161fa.3 for ; Sat, 11 May 2024 04:54:13 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428452; x=1716033252; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cCWM57OHz2JIAYU8qBsg/sKiTEv/cPu3ovotF6RL+Z8=; b=kfWURy32Zi2yAYisiVAsgy741USynyaBZnMAnSUKuxo1eAfBA8GsRjMVCz+7nvK6GZ B8tg6XW7EH5UsWBbL8wOB9k39lVSoUSWPxSow/OIZ5y4cjz3PLfVxtx7s6aQcaglbL+x OHNjQ3y4TOwii3jTQ/s5s9f+gOv1vp3OnobafJ6dtG/QmOxU51WH8A2g/hmPq7HAq6rj SuMwrHDn/JS9frG5TI0XPcilNdtJOpW6i0evtLoj9iRY7C90ujQQf1piSuxOtKDSAFs1 Ijkw/7AykcD3m7G7iLChcjvgWn2dB6Kjmh8LVIHCEw1I9lmM5BVOB4Fe6tOZlaBG1Q3y 0nQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428452; x=1716033252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cCWM57OHz2JIAYU8qBsg/sKiTEv/cPu3ovotF6RL+Z8=; b=IQkzETg+5Kn707cUV3tnU9kunQjemzf9wmF2h4V40aLSj/lVFh1H4mEbTs6dXNMs67 8o92FLQm8trX/TgFr1maTIpYp9P8OvrtC+SdDpvM6KxchL1Z/ULRXHJzTSkcZWJuYVpF g+A8AC4inNVex8o2AUooJfnqwlcyXDgj5mOjebxV+2LLUAZzRrMlbXQH3TYHoJcJV6Dq JnZ1mh58hBHattqyIKTudUDKd/WC6/or+4WcP+DZvre0RirHI4I3EPYBSUNN3z/Vq5/t VPIJU4gqnlSHqzVWPu1J89qI+QYzsGXVvH5entAzK/fYfYMJrUHywz9mTTt4FXoxkybb cunA== X-Gm-Message-State: AOJu0Ywx/ELUFj1/LdQRcD2F0rSPw3Uab8umcnJBhJf3XsivZirpwUZI MtOT22F/rbbd6Gv9uCDckW27XxgcRGeY9ytZnsAAzViylWM8/5XceCkHW11dEFGK1gs5SZNq1+x E8vI= X-Google-Smtp-Source: AGHT+IF3gseo0zQlzpUdlDtgdnibkTBQluOCJVlesMeJydhNK0HKiM3UOHhZtgQKr9KrAO5cHbNZYQ== X-Received: by 2002:a05:6512:308f:b0:51a:c21b:73fb with SMTP id 2adb3069b0e04-5221007498fmr3804932e87.44.1715428452385; Sat, 11 May 2024 04:54:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 10/17] aarch64: Tidy reginfo dumping ahead of ZA state Date: Sat, 11 May 2024 13:53:53 +0200 Message-Id: <20240511115400.7587-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428680872100003 Content-Type: text/plain; charset="utf-8" A misalignment for sve_vl, plus add a bit more space on the left for the ZA[n] field name. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu_reginfo_aarch64.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 0161044..86e70ab 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -183,6 +183,18 @@ static int sve_preg_is_eq(int vq, const void *p1, cons= t void *p2) return memcmp(p1, p2, vq * 2) =3D=3D 0; } =20 +static void sve_dump_zreg(FILE *f, int vq, const uint64_t *z) +{ + const char *pad =3D ""; + int q; + + for (q =3D 0; q < vq; q++) { + fprintf(f, "%s[%-2d] %016" PRIx64 "%016" PRIx64 "\n", + pad, q, z[2 * q + 1], z[2 * q]); + pad =3D " "; /* 11 spaces */ + } +} + static void sve_dump_preg(FILE *f, int vq, const uint16_t *p) { int q; @@ -211,10 +223,10 @@ static void sve_dump_zreg_diff(FILE *f, int vq, const= uint64_t *za, uint64_t zb0 =3D zb[2 * q], zb1 =3D zb[2 * q + 1]; =20 if (za0 !=3D zb0 || za1 !=3D zb1) { - fprintf(f, "%sq%-2d: %016" PRIx64 "%016" PRIx64 + fprintf(f, "%s[%-2d]: %016" PRIx64 "%016" PRIx64 " vs %016" PRIx64 "%016" PRIx64"\n", pad, q, za1, za0, zb1, zb0); - pad =3D " "; + pad =3D " "; /* 11 spaces */ } } } @@ -237,19 +249,14 @@ void reginfo_dump(struct reginfo *ri, FILE * f) =20 if (ri->sve_vl) { int vq =3D sve_vq_from_vl(ri->sve_vl); - int q; =20 fprintf(f, " vl : %d\n", ri->sve_vl); =20 for (i =3D 0; i < SVE_NUM_ZREGS; i++) { uint64_t *z =3D reginfo_zreg(ri, vq, i); =20 - fprintf(f, " Z%-2d q%-2d: %016" PRIx64 "%016" PRIx64 "\n", - i, 0, z[1], z[0]); - for (q =3D 1; q < vq; ++q) { - fprintf(f, " q%-2d: %016" PRIx64 "%016" PRIx64 "\n", - q, z[q * 2 + 1], z[q * 2]); - } + fprintf(f, " Z%-2d : ", i); + sve_dump_zreg(f, vq, z); } =20 for (i =3D 0; i < SVE_NUM_PREGS + 1; i++) { @@ -312,7 +319,7 @@ void reginfo_dump_mismatch(struct reginfo *m, struct re= ginfo *a, FILE * f) } =20 if (m->sve_vl !=3D a->sve_vl) { - fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); + fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); } =20 if (m->sve_vl) { @@ -323,7 +330,7 @@ void reginfo_dump_mismatch(struct reginfo *m, struct re= ginfo *a, FILE * f) uint64_t *za =3D reginfo_zreg(a, vq, i); =20 if (!sve_zreg_is_eq(vq, zm, za)) { - fprintf(f, " Z%-2d ", i); + fprintf(f, " Z%-2d : ", i); sve_dump_zreg_diff(f, vq, zm, za); } } --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428557; cv=none; d=zohomail.com; s=zohoarc; b=HKoA8rRaRNkJ8Fmq5ETWXps+2bCHcHn5QWSkXvrBC6Dn6o7zjvCz0/GgZFkFOvM03UGv5reof+nxUaj6bevJheddNhu1NSbCn4RMH8L1IE5T0NLb0hb+uHzkqbyWiopWPqVYBlD3WeuFEG27ZylHNnt9M8t6LURBGMDBYvConkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428557; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CUAtQ4JWX99wQQNvfX1Znsvuc3Jvk42mU9SVFi0MMTs=; b=msr50+dkeQ2YNMapxwP4piPPvk9Y11GDnH4mDkuoG0Z/oQAAw0t7n0baEE/ptL3Mwu06vCVJWwJkyHG/SQ7ycuwr4uJgpG0Sv7GJ8zh8pOvaE5UAtZV/7GaNCMhTBZBsLOa2ReEebSqTyW8+WS74svH28ht08VupyQgmO8rqsn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428557081499.2276213843692; Sat, 11 May 2024 04:55:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIx-0000Lq-CN; Sat, 11 May 2024 07:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIv-0000LE-8I for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:17 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIt-0006zb-0g for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:17 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-350513d2c6aso1137618f8f.2 for ; Sat, 11 May 2024 04:54:14 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428453; x=1716033253; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CUAtQ4JWX99wQQNvfX1Znsvuc3Jvk42mU9SVFi0MMTs=; b=j17oNVJ28OY1269q1gbjNcBDPxEfNZd3HAv2tBu4TzI2DeacexCB6cO4a4ONsiUAiH 4d0iz/73gIWRtg033NI3bpMgha4euXxQkPb6mATqH5Wk+vuUhX7xUesCB++smf0tmMu8 zBdMGG5gH+PWSZuNPh+M0Z5IH3llKYOJMqJKUjDBRnrxS2uCfUCb8xs+/LSIeCbQ9tYj 8mIe4XPmAPGtOiVorQhqdm/lO5wd1SCXqqTgQBgm09Wfh3zwV9hqQLxAx/z5i0CSpWbT P+M8PgM4HPJk9sJs7/Oy25Gk3KFh/70W14LK97HwHWjWm4q0dLCObZb5LOWpugBhkDZr Btsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428453; x=1716033253; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CUAtQ4JWX99wQQNvfX1Znsvuc3Jvk42mU9SVFi0MMTs=; b=Bt8CCjeZITyAxJ7SC4ElMMpPPCz/Gwqvp75SRxt4BCPzkZ00LewPwtkF02pe0ESYaw /BrDjIh4h9Xs5/vYzS+k4VV5KFgTMU31+rEwkL/YQRdjwNoOFBp8Z+8LgcBKW8341F3C k0RrOJ8qlotQK1YWqs+MrtKzQBYHas0sQyoQN1DxLwWG79X/Ark8GdQ8N1E8v64Oce9e aLuCZKiEIQ+Yrjr7ZluEaRXnZjVs8+tRhEf6kfbrsNkrOTWhmhkgExzv+MZIWJLAGKqx MXKeoCgDUsFZBJ8bJbFu+atTaKJF1tVtN2k3ATPaOUsMa1DRlvJ8Tn1H8bG2uFx6SlBN uJaw== X-Gm-Message-State: AOJu0YyPNAJUPAUkSoZ417rBHd5qNn09QQPDSjZ6kGVSCkSB17zAbUQg EMiqXiNCTqFo+bQUYRZhhetQSzmq1CwB/2rTkITnQi0JYbGvrzMKySYboaK2a7At2Ud1gxAG6gI E1mk= X-Google-Smtp-Source: AGHT+IG/qAMpd3CRrN0sGpR5ugsYy6Q5A5C/OlZYAVDInbOvUgmSWfFzVssFjO/CvZepxor4s3jh+Q== X-Received: by 2002:a5d:4d4a:0:b0:34d:b70e:1ec7 with SMTP id ffacd0b85a97d-3504a630f0amr3424172f8f.16.1715428453564; Sat, 11 May 2024 04:54:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 11/17] aarch64: Add support for ZA storage Date: Sat, 11 May 2024 13:53:54 +0200 Message-Id: <20240511115400.7587-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428558310100003 Content-Type: text/plain; charset="utf-8" Require NVL =3D=3D SVL on startup, to make it easier to manage reginfo. Most of the time PSTATE.SM would be active with PSTATE.ZA anyway, for any non-trivial SME testing. Extend saved storage only when PSTATE.ZA is active. Use a carefully reserved uint16_t for saving SVCR. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- risu_reginfo_aarch64.h | 52 ++++++++++++- risu_reginfo_aarch64.c | 161 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 191 insertions(+), 22 deletions(-) diff --git a/risu_reginfo_aarch64.h b/risu_reginfo_aarch64.h index 536c12b..097b7ad 100644 --- a/risu_reginfo_aarch64.h +++ b/risu_reginfo_aarch64.h @@ -21,6 +21,43 @@ #define SVE_VQ_MAX 16 =20 #define ROUND_UP(SIZE, POW2) (((SIZE) + (POW2) - 1) & -(POW2)) + +#ifdef ZA_MAGIC +/* System headers have all Streaming SVE definitions. */ +typedef struct sve_context risu_sve_context; +typedef struct za_context risu_za_context; +#else +#define ZA_MAGIC 0x54366345 +#define SVE_SIG_FLAG_SM 1 + +/* System headers missing flags field. */ +typedef struct { + struct _aarch64_ctx head; + uint16_t vl; + uint16_t flags; + uint16_t reserved[2]; +} risu_sve_context; + +typedef struct { + struct _aarch64_ctx head; + uint16_t vl; + uint16_t reserved[3]; +} risu_za_context; + +#define ZA_SIG_REGS_OFFSET \ + ROUND_UP(sizeof(risu_za_context), SVE_VQ_BYTES) + +#define ZA_SIG_REGS_SIZE(vq) \ + ((vq) * (vq) * SVE_VQ_BYTES * SVE_VQ_BYTES) + +#define ZA_SIG_ZAV_OFFSET(vq, n) \ + (ZA_SIG_REGS_OFFSET + (SVE_SIG_ZREG_SIZE(vq) * n)) + +#define ZA_SIG_CONTEXT_SIZE(vq) \ + (ZA_SIG_REGS_OFFSET + ZA_SIG_REGS_SIZE(vq)) + +#endif /* ZA_MAGIC */ + #define RISU_SVE_REGS_SIZE(VQ) ROUND_UP(SVE_SIG_REGS_SIZE(VQ), 16) #define RISU_SIMD_REGS_SIZE (32 * 16) =20 @@ -36,12 +73,16 @@ struct reginfo { uint32_t fpsr; uint32_t fpcr; uint16_t sve_vl; - uint16_t reserved; + uint16_t svcr; =20 - char extra[RISU_SVE_REGS_SIZE(SVE_VQ_MAX)] + char extra[RISU_SVE_REGS_SIZE(SVE_VQ_MAX) + + ZA_SIG_REGS_SIZE(SVE_VQ_MAX)] __attribute__((aligned(16))); }; =20 +#define SVCR_SM 1 +#define SVCR_ZA 2 + static inline uint64_t *reginfo_vreg(struct reginfo *ri, int i) { return (uint64_t *)&ri->extra[i * 16]; @@ -59,4 +100,11 @@ static inline uint16_t *reginfo_preg(struct reginfo *ri= , int vq, int i) SVE_SIG_REGS_OFFSET]; } =20 +static inline uint64_t *reginfo_zav(struct reginfo *ri, int vq, int i) +{ + return (uint64_t *)&ri->extra[RISU_SVE_REGS_SIZE(vq) + + ZA_SIG_ZAV_OFFSET(vq, i) - + ZA_SIG_REGS_OFFSET]; +} + #endif /* RISU_REGINFO_AARCH64_H */ diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 86e70ab..67a2999 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -25,25 +25,44 @@ #include "risu.h" #include "risu_reginfo_aarch64.h" =20 +#ifndef PR_SME_SET_VL +#define PR_SME_SET_VL 63 +#endif + /* Should we test SVE register state */ static int test_sve; +static int test_za; static const struct option extra_opts[] =3D { {"test-sve", required_argument, NULL, FIRST_ARCH_OPT }, + {"test-za", required_argument, NULL, FIRST_ARCH_OPT + 1 }, {0, 0, 0, 0} }; =20 const struct option * const arch_long_opts =3D &extra_opts[0]; const char * const arch_extra_help - =3D " --test-sve=3D Compare SVE registers with VQ\n"; + =3D " --test-sve=3D Compare SVE registers with VQ\n" + " --test-za=3D Compare ZA storage with VQ\n"; =20 void process_arch_opt(int opt, const char *arg) { - assert(opt =3D=3D FIRST_ARCH_OPT); - test_sve =3D strtol(arg, 0, 10); - - if (test_sve <=3D 0 || test_sve > SVE_VQ_MAX) { - fprintf(stderr, "Invalid value for VQ (1-%d)\n", SVE_VQ_MAX); - exit(EXIT_FAILURE); + switch (opt) { + case FIRST_ARCH_OPT: + test_sve =3D strtol(arg, 0, 10); + if (test_sve <=3D 0 || test_sve > SVE_VQ_MAX) { + fprintf(stderr, "Invalid value for SVE VQ (1-%d)\n", SVE_VQ_MA= X); + exit(EXIT_FAILURE); + } + break; + case FIRST_ARCH_OPT + 1: + test_za =3D strtol(arg, 0, 10); + if (test_za <=3D 0 || test_za > SVE_VQ_MAX + || (test_za & (test_za - 1))) { + fprintf(stderr, "Invalid value for ZA VQ (1-%d)\n", SVE_VQ_MAX= ); + exit(EXIT_FAILURE); + } + break; + default: + abort(); } } =20 @@ -51,6 +70,31 @@ void arch_init(void) { long want, got; =20 + if (test_za) { + /* + * For now, reginfo requires NVL =3D=3D SVL. + * There doesn't seem to be much advantage to differing. + */ + if (test_sve && test_sve !=3D test_za) { + fprintf(stderr, "Mismatched values for SVE and ZA VQ\n"); + exit(EXIT_FAILURE); + } + + want =3D sve_vl_from_vq(test_za); + got =3D prctl(PR_SME_SET_VL, want); + if (want !=3D got) { + if (got >=3D 0) { + fprintf(stderr, "Unsupported VQ for ZA (%d !=3D %d)\n", + test_za, (int)sve_vq_from_vl(got)); + } else if (errno =3D=3D EINVAL) { + fprintf(stderr, "System does not support SME\n"); + } else { + perror("prctl PR_SME_SET_VL"); + } + exit(EXIT_FAILURE); + } + } + if (test_sve) { want =3D sve_vl_from_vq(test_sve); got =3D prctl(PR_SVE_SET_VL, want); @@ -75,6 +119,9 @@ int reginfo_size(struct reginfo *ri) if (ri->sve_vl) { int vq =3D sve_vq_from_vl(ri->sve_vl); size +=3D RISU_SVE_REGS_SIZE(vq); + if (ri->svcr & SVCR_ZA) { + size +=3D ZA_SIG_REGS_SIZE(vq); + } } else { size +=3D RISU_SIMD_REGS_SIZE; } @@ -84,10 +131,11 @@ int reginfo_size(struct reginfo *ri) /* reginfo_init: initialize with a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr) { - int i; + int i, vq; struct _aarch64_ctx *ctx, *extra =3D NULL; struct fpsimd_context *fp =3D NULL; - struct sve_context *sve =3D NULL; + risu_sve_context *sve =3D NULL; + risu_za_context *za =3D NULL; =20 /* necessary to be able to compare with memcmp later */ memset(ri, 0, sizeof(*ri)); @@ -112,6 +160,9 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr) case SVE_MAGIC: sve =3D (void *)ctx; break; + case ZA_MAGIC: + za =3D (void *)ctx; + break; case EXTRA_MAGIC: extra =3D (void *)((struct extra_context *)(ctx))->datap; break; @@ -134,21 +185,55 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc,= void *siaddr) ri->fpsr =3D fp->fpsr; ri->fpcr =3D fp->fpcr; =20 - if (test_sve) { - int vq =3D test_sve; + /* + * Note that arch_init required NVL=3D=3DSVL, so test_sve and test_za + * are equal when non-zero. We will verify this matches below. + */ + vq =3D test_sve | test_za; + ri->sve_vl =3D sve_vl_from_vq(vq); =20 - if (sve =3D=3D NULL) { - fprintf(stderr, "risu_reginfo_aarch64: failed to get SVE state= \n"); + if (test_za) { + if (za =3D=3D NULL) { + /* ZA_MAGIC is supposed to be present, even if empty. */ + fprintf(stderr, "risu_reginfo_aarch64: missing ZA state\n"); return; } + assert(za->head.size >=3D ZA_SIG_CONTEXT_SIZE(0)); =20 - if (sve->vl !=3D sve_vl_from_vq(vq)) { + if (za->vl !=3D ri->sve_vl) { fprintf(stderr, "risu_reginfo_aarch64: " - "unexpected SVE state: %d !=3D %d\n", - sve->vl, sve_vl_from_vq(vq)); + "unexpected ZA VQ: %d !=3D %d\n", + za->vl, ri->sve_vl); + return; + } + if (za->head.size =3D=3D ZA_SIG_CONTEXT_SIZE(0)) { + /* ZA storage is disabled. */ + } else if (za->head.size < ZA_SIG_CONTEXT_SIZE(vq)) { + fprintf(stderr, "risu_reginfo_aarch64: " + "failed to get complete ZA state\n"); + return; + } else { + ri->svcr |=3D SVCR_ZA; + memcpy(reginfo_zav(ri, vq, 0), (char *)za + ZA_SIG_REGS_OFFSET, + ZA_SIG_CONTEXT_SIZE(vq) - ZA_SIG_REGS_OFFSET); + } + } + + if (test_sve) { + if (sve =3D=3D NULL) { + /* SVE_MAGIC is supposed to be present, even if empty. */ + fprintf(stderr, "risu_reginfo_aarch64: missing SVE state\n"); return; } =20 + if (sve->vl !=3D ri->sve_vl) { + fprintf(stderr, "risu_reginfo_aarch64: " + "unexpected SVE VQ: %d !=3D %d\n", + sve->vl, ri->sve_vl); + return; + } + + ri->svcr |=3D sve->flags & SVE_SIG_FLAG_SM; if (sve->head.size <=3D SVE_SIG_CONTEXT_SIZE(0)) { /* Only AdvSIMD state is present. */ } else if (sve->head.size < SVE_SIG_CONTEXT_SIZE(vq)) { @@ -156,7 +241,6 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr) "failed to get complete SVE state\n"); return; } else { - ri->sve_vl =3D sve->vl; memcpy(reginfo_zreg(ri, vq, 0), (char *)sve + SVE_SIG_REGS_OFFSET, SVE_SIG_REGS_SIZE(vq)); @@ -164,7 +248,18 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, = void *siaddr) } } =20 - memcpy(reginfo_vreg(ri, 0), fp->vregs, RISU_SIMD_REGS_SIZE); + /* + * Be prepared for ZA state present but SVE state absent (VQ !=3D 0). + * In which case, copy AdvSIMD vregs into the low portion of zregs; + * pregs remain all zero. + */ + if (vq =3D=3D 0) { + memcpy(reginfo_vreg(ri, 0), fp->vregs, RISU_SIMD_REGS_SIZE); + } else { + for (i =3D 0; i < 32; ++i) { + memcpy(reginfo_zreg(ri, vq, i), &fp->vregs[i], 16); + } + } } =20 /* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ @@ -248,9 +343,11 @@ void reginfo_dump(struct reginfo *ri, FILE * f) fprintf(f, " fpcr : %08x\n", ri->fpcr); =20 if (ri->sve_vl) { - int vq =3D sve_vq_from_vl(ri->sve_vl); + int vl =3D ri->sve_vl; + int vq =3D sve_vq_from_vl(vl); =20 - fprintf(f, " vl : %d\n", ri->sve_vl); + fprintf(f, " vl : %d\n", vl); + fprintf(f, " svcr : %d\n", ri->svcr); =20 for (i =3D 0; i < SVE_NUM_ZREGS; i++) { uint64_t *z =3D reginfo_zreg(ri, vq, i); @@ -270,6 +367,14 @@ void reginfo_dump(struct reginfo *ri, FILE * f) sve_dump_preg(f, vq, p); fprintf(f, "\n"); } + + if (ri->svcr & SVCR_ZA) { + for (i =3D 0; i < vl; ++i) { + uint64_t *z =3D reginfo_zav(ri, vq, i); + fprintf(f, " ZA[%-3d]: ", i); + sve_dump_zreg(f, vq, z); + } + } return; } =20 @@ -322,6 +427,10 @@ void reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE * f) fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); } =20 + if (m->svcr !=3D a->svcr) { + fprintf(f, " svcr : %d vs %d\n", m->svcr, a->svcr); + } + if (m->sve_vl) { int vq =3D sve_vq_from_vl(m->sve_vl); =20 @@ -347,6 +456,18 @@ void reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE * f) sve_dump_preg_diff(f, vq, pm, pa); } } + + if (m->svcr & a->svcr & SVCR_ZA) { + for (i =3D 0; i < vq * 16; i++) { + uint64_t *zm =3D reginfo_zav(m, vq, i); + uint64_t *za =3D reginfo_zav(a, vq, i); + + if (!sve_zreg_is_eq(vq, zm, za)) { + fprintf(f, " ZA[%-3d]: ", i); + sve_dump_zreg_diff(f, vq, zm, za); + } + } + } return; } =20 --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428603; cv=none; d=zohomail.com; s=zohoarc; b=D2Sd+H6LN9iTVXBqLvxzGEdpsvYraQ/d1YlMC6iC6vE1TKZaVZatpRZWJ+fMVtB9FFrmT1+L0zK+8touupfMI7gPKYpetmNKjJ/gHiuhlwXnc6mb9slSmnAwwZnRuRfnZKfiRUFAinfItf1bo5bNyHXL1LRM3rFaZIQ+eQ8ud8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428603; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TszikIIR0P364Y+SfqYmtCRzUOVzTKFI40YQ9lx2ZZQ=; b=MyVjarQwGOiBUhT92hGxegOO/ygmujpO6AyIDAV2Zsh2GNi7850K9FUEadGi6MqkTu96ScCVv7xVM68vrJx2I7c0z6O41M0RG5XsIYjLecmcn1HM+cEU116YGRbU9TFH0hQ+0XlihmopHXn5PllvAiUTHlr3V0+5CpODtq3oUlE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428603496867.9478836725601; Sat, 11 May 2024 04:56:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIy-0000Ml-IL; Sat, 11 May 2024 07:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIv-0000Lc-Ul for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:17 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIu-000701-3y for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:17 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-34d7d04808bso2029908f8f.0 for ; Sat, 11 May 2024 04:54:15 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428454; x=1716033254; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TszikIIR0P364Y+SfqYmtCRzUOVzTKFI40YQ9lx2ZZQ=; b=DRPzxLOmN0bK+oy83RYmAk514pFRLzU3B2vPzC0HFumODOX2nX5DuphSONvURsNO+d 8rgEvUXGxW99d6AeHqqx5ctdd/4vMxB6aBVed+lzi3Yk/Wjd7ABxukvJSJj6P2y4q8Tk Pi4aHBUo8rR5wMrvLvFMcvyt3p7tw7yW+95HrhrADCZ9xWvrNIQLonCJSJBv6kD6L5z9 D2bhLUie0jbex0vg4ohwvoaj/0sv0FSNmMuNrWDTCdDbYbErW7tqXLo7ddEhuoDbldi5 r24FIHcy7DUnbwY2VTTQD0phaqueJ+Lw134b6kJukOVaDZiQLhCC2nrm1gEeko6gI4/s Shkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428454; x=1716033254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TszikIIR0P364Y+SfqYmtCRzUOVzTKFI40YQ9lx2ZZQ=; b=j+9YNHV0lP+AZpy8YPw+2DDOYar/bzE2xjKRrlLBN+3yXG7liOHaQwfi4P4DdoXexM J01weVpy8xPqvHU2kIhUHIp7YUA2mykXJcsF46hLNt4Dp8FYJEnDJSwO3vDex7YJH8FP J0gsOmw5shxzkNwFP1o7ZGs4K7N7/LGbVRqeEgLcOrtPdsuaUHd3XKqufLrsnpKtFZek nGCB28b6xtu2GJyCF5pom6hBeiQUGhgbzSn2jYA5znPlBx6w6kxPt3FVWNLCyFz3L3Av sAiFxf7N1AJYZAY2LGa4pDhSf6tE32lB9iREmsEdhXRUk5XQulk23yb925fzMGnL2VSy RAww== X-Gm-Message-State: AOJu0YwofIk5A+h3qnUq4gyBL4n+/T1/uCXzFOYHa12zwnRZldQ3QTiG hqaH5vA6VBJcReyWBH1l1aG8xxxC9BKiYNw8rIsf73o9KlBEp8GRoTe7TVu3JwoQEn+SK3TOD24 Ccs4= X-Google-Smtp-Source: AGHT+IF9EqG2lwjbMa0DFrrLcJXXEC0qlFbRB7QMEv2Xh6wHmE8IXqSCdVpyP+DrxGZ7yh4Fw39FxQ== X-Received: by 2002:adf:ef4c:0:b0:349:bccc:a1e7 with SMTP id ffacd0b85a97d-3504a6310c6mr5585661f8f.19.1715428454677; Sat, 11 May 2024 04:54:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 12/17] aarch64: Trivial SME test Date: Sat, 11 May 2024 13:53:55 +0200 Message-Id: <20240511115400.7587-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428604652100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- test_sme_aarch64.s | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test_sme_aarch64.s diff --git a/test_sme_aarch64.s b/test_sme_aarch64.s new file mode 100644 index 0000000..acd08d4 --- /dev/null +++ b/test_sme_aarch64.s @@ -0,0 +1,63 @@ +/*************************************************************************= **** + * Copyright (c) 2022 Linaro Limited + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *************************************************************************= ****/ + + .arch_extension sme + + mov w0, #0 + mov w1, #0 + mov w2, #0 + mov w3, #0 + mov w4, #0 + mov w5, #0 + mov w6, #0 + mov w7, #0 + mov w8, #0 + mov w9, #0 + mov w10, #0 + mov w11, #0 + mov w12, #0 + mov w13, #0 + mov w14, #0 + mov w15, #0 + mov w16, #0 + mov w17, #0 + mov w18, #0 + mov w19, #0 + mov w20, #0 + mov w21, #0 + mov w22, #0 + mov w23, #0 + mov w24, #0 + mov w25, #0 + mov w26, #0 + mov w27, #0 + mov w28, #0 + mov w29, #0 + mov w30, #0 + + smstart + + ptrue p0.b + rdsvl x12, #1 + +0: subs w12, w12, #1 + lsl w13, w12, #4 + index z0.b, w13, #1 + mova za0h.b[w12, #0], p0/m, z0.b + b.ne 0b + + .inst 0x00005af0 /* compare */ + + rdsvl x12, #1 +0: subs w12, w12, #1 + lsl w13, w12, #4 + index z0.b, w13, #1 + mova za0v.b[w12, #0], p0/m, z0.b + b.ne 0b + + .inst 0x00005af1 /* exit */ --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428533; cv=none; d=zohomail.com; s=zohoarc; b=GgFc/2VEcPJV1oANlDIT1oqbXnqeW8xoFivkbuZRVSVjbcDSBEZp7AwGhUqxedLnyvctSt9rpJTHpk75+QkFRRlkwwUfb2PmE/TrNd3NGTyvzUNy7hmmTpEKg7Lo4h09dV772yJE4UZAhBNiXAqf9+ElZ1HOewk84TPbTwpCqNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428533; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Hfxi5Tt4Z237MIY1mS3UWYWqzflEOIMry0lrn96HNUo=; b=UsuVpfTCKtUx/jm28ftgg0jf+FMZV0krKFzXDTO6aTEO0hhMeVeYQ8d1jNGrYDuXV7lqzOxMdCg/fs2tRUxE4l/PjXRQQGzvBFQUGB4E7BOGgMfKhmKHPRU/4G624dhNjwGhBOeojMsJZYcm11mVDVEDKPRIO1iJG96s9OTQTOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428533093885.6716999912288; Sat, 11 May 2024 04:55:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIz-0000Mt-6H; Sat, 11 May 2024 07:54:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIx-0000M1-Tj for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:19 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIu-00070B-Uf for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:19 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-34db6a299b8so2090894f8f.3 for ; Sat, 11 May 2024 04:54:16 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428455; x=1716033255; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hfxi5Tt4Z237MIY1mS3UWYWqzflEOIMry0lrn96HNUo=; b=EkQN/fjF/nx6K6220BFNxORdoLPEyNMH+cdf167MjTFwO/u2Hje3l+Ly5jbcLiYyUh sLqwbDNWtdhsa7igsFWJt3iWlXd+lAvg7KkQsA7b+fzOilvtcMO/7BL5gi0tUKKnqR1l jnARhKefMwNF4qB9E/kAsPUsXjRyp0AAsE/UXZLFAf68JGQwLQZhZd9rbO++mNgyI1TK PlQAOAokrCqM2amLH0xU4eRcAwZiALQh9Be88ZqOhjFstW9uQ+a1rCGICjp1wAe77Ngi KNfIVFDO7jbvPRdsC2zwkQeNxKtvLrn+YsefbGBOOf9JOXljkH4O+wxSVuyYp2Tm8KUo IjeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428455; x=1716033255; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hfxi5Tt4Z237MIY1mS3UWYWqzflEOIMry0lrn96HNUo=; b=ESx2uHd61c+RnNEXi757Fp8JRQkYAfYtOBa1yMl5oThxFR6hwe1kydlBh43gAuXK2I ofDAApasmGOYTxmgy+ctKoGLDvpC7jA5DTz+5JAOYgy0x7U8bRIZRK40RukKU5r1Wh7K pO4qCNm44ws13u1yZZ8nPBnYbHsFX6dm9PEv/PTXdKLZ5IyaV+yYRpR1It24VsNWhTGE jTmYvgCooYiHrkYQ0xGuoQ4Gtu6etNiBmLCyScFhEDoDBJCJXKNm1K/fHvJh751m8f2r pkpBxEbvTjJQ+IyPSPYkSwnxXpJy7gAIfhSc1lECG3XKWsExscHq6qX1wVwccWulZqfE jOeg== X-Gm-Message-State: AOJu0YyKtua68+JH360SLIfhqkiB/sNyX2A/DFtnspffivz0qn9GI/fp e2yMeb21qLQWAJwDVb6arEhGCHJ3bJEzjtnHcZczvKddfZG+KAyDXHQM/gYjqQwBMbfB67JZ1oK Yy/w= X-Google-Smtp-Source: AGHT+IE0Orr9TikqvutXVKw6KTHFrtGNRIRTWEDc2d61phOhONmJKtDBVJlQfVtv7SzYxGs/OiErQg== X-Received: by 2002:adf:e904:0:b0:34c:5429:497e with SMTP id ffacd0b85a97d-3504a623031mr3505485f8f.8.1715428455440; Sat, 11 May 2024 04:54:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 13/17] Use bool for reginfo_is_eq Date: Sat, 11 May 2024 13:53:56 +0200 Message-Id: <20240511115400.7587-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428534452100003 Content-Type: text/plain; charset="utf-8" The function result is more naturally boolean. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu.h | 4 ++-- risu_reginfo_aarch64.c | 4 ++-- risu_reginfo_arm.c | 4 ++-- risu_reginfo_i386.c | 4 ++-- risu_reginfo_loongarch64.c | 4 ++-- risu_reginfo_m68k.c | 16 ++++++++-------- risu_reginfo_ppc64.c | 4 ++-- risu_reginfo_s390x.c | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/risu.h b/risu.h index aa8cc22..4203178 100644 --- a/risu.h +++ b/risu.h @@ -117,8 +117,8 @@ uintptr_t get_pc(struct reginfo *ri); /* initialize structure from a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr); =20 -/* return 1 if structs are equal, 0 otherwise. */ -int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2); +/* return true if structs are equal, false otherwise. */ +bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2); =20 /* print reginfo state to a stream */ void reginfo_dump(struct reginfo *ri, FILE *f); diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 67a2999..55a9ef6 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -262,8 +262,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr) } } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) +/* reginfo_is_eq: compare the reginfo structs, returns true if equal */ +bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) { return memcmp(r1, r2, reginfo_size(r1)) =3D=3D 0; } diff --git a/risu_reginfo_arm.c b/risu_reginfo_arm.c index 0e179be..d11e666 100644 --- a/risu_reginfo_arm.c +++ b/risu_reginfo_arm.c @@ -155,8 +155,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr) reginfo_init_vfp(ri, uc); } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) +/* reginfo_is_eq: compare the reginfo structs, returns true if equal */ +bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) { return memcmp(r1, r2, sizeof(*r1)) =3D=3D 0; /* ok since we memset = 0 */ } diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index f4cf9a3..1c579fa 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -234,8 +234,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr) #endif } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *m, struct reginfo *a) +/* reginfo_is_eq: compare the reginfo structs, returns true if equal */ +bool reginfo_is_eq(struct reginfo *m, struct reginfo *a) { return !memcmp(m, a, sizeof(*m)); } diff --git a/risu_reginfo_loongarch64.c b/risu_reginfo_loongarch64.c index 060715f..6150a40 100644 --- a/risu_reginfo_loongarch64.c +++ b/risu_reginfo_loongarch64.c @@ -153,8 +153,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *conte= xt, void *siaddr) } } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) +/* reginfo_is_eq: compare the reginfo structs */ +bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) { return !memcmp(r1, r2, sizeof(*r1)); } diff --git a/risu_reginfo_m68k.c b/risu_reginfo_m68k.c index a53244d..7335195 100644 --- a/risu_reginfo_m68k.c +++ b/risu_reginfo_m68k.c @@ -55,13 +55,13 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, v= oid *siaddr) } } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *m, struct reginfo *a) +/* reginfo_is_eq: compare the reginfo structs, returns true if equal */ +bool reginfo_is_eq(struct reginfo *m, struct reginfo *a) { int i; =20 if (m->gregs[R_PS] !=3D a->gregs[R_PS]) { - return 0; + return false; } =20 for (i =3D 0; i < 16; i++) { @@ -69,27 +69,27 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) continue; } if (m->gregs[i] !=3D a->gregs[i]) { - return 0; + return false; } } =20 if (m->fpregs.f_pcr !=3D a->fpregs.f_pcr) { - return 0; + return false; } =20 if (m->fpregs.f_psr !=3D a->fpregs.f_psr) { - return 0; + return false; } =20 for (i =3D 0; i < 8; i++) { if (m->fpregs.f_fpregs[i][0] !=3D a->fpregs.f_fpregs[i][0] || m->fpregs.f_fpregs[i][1] !=3D a->fpregs.f_fpregs[i][1] || m->fpregs.f_fpregs[i][2] !=3D a->fpregs.f_fpregs[i][2]) { - return 0; + return false; } } =20 - return 1; + return true; } =20 /* reginfo_dump: print state to a stream */ diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index 730a565..a8e5935 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -64,8 +64,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, voi= d *siaddr) ri->vrregs.vrsave =3D uc->uc_mcontext.v_regs->vrsave; } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *m, struct reginfo *a) +/* reginfo_is_eq: compare the reginfo structs, returns true if equal */ +bool reginfo_is_eq(struct reginfo *m, struct reginfo *a) { return memcmp(m, a, sizeof(*m)) =3D=3D 0; } diff --git a/risu_reginfo_s390x.c b/risu_reginfo_s390x.c index cbf168e..d18b94f 100644 --- a/risu_reginfo_s390x.c +++ b/risu_reginfo_s390x.c @@ -73,8 +73,8 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, voi= d *siaddr) memcpy(ri->fprs, &uc->uc_mcontext.fpregs.fprs, sizeof(ri->fprs)); } =20 -/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *m, struct reginfo *a) +/* reginfo_is_eq: compare the reginfo structs */ +bool reginfo_is_eq(struct reginfo *m, struct reginfo *a) { return m->pc_offset =3D=3D a->pc_offset && m->fpc =3D=3D a->fpc && --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428511; cv=none; d=zohomail.com; s=zohoarc; b=fJA2rryBCZO0SBgmOMyD18ouoGqEvH+OWXaoceDHbfVph8OrSQdm0zsH47K3A5VHqgdqVZP7FMb0vecIG8pp/cfM7RPpJ84vJOzGZmfGJg6CaTsNiDX3yQDz+pV7e9/NgNS6yupgrQ5GyK/wB5wRV8qsp3mF72bknuTg0tslQwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428511; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G/dRk75Xa2dli8e7P8dUDOHpTSk+dp2zsSzv4pGi5N4=; b=GIh6QZvYWLT+6SU7GiOb4Rlcc9ipP7TjVr5mJePa3WoDiwnivKtQdT5ucvBuvDgYsr8TKwhepw2BJKS0u1xEkqksVFFZ1evRNhm5+UdPixQKvXDaVqlaOzrvXiNpGkDpEJQ7nt0Njl6Q7UVuJ3Ro4erJQujsSjOylFzvPCH6mt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428511664694.1632992977901; Sat, 11 May 2024 04:55:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIz-0000N4-I6; Sat, 11 May 2024 07:54:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIx-0000Lo-86 for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:19 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIv-00070K-Mf for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:19 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-34da04e44a2so2095194f8f.1 for ; Sat, 11 May 2024 04:54:17 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428456; x=1716033256; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G/dRk75Xa2dli8e7P8dUDOHpTSk+dp2zsSzv4pGi5N4=; b=QD47BkWW9q96XcJcMaBATjXWSH81ks9IjNgK8qQ2XOETSOy++Zo5G4iPmyBiwaMFvX snFAHCeEQy58+9uuzNSNuRcNxV9ccV6Iih7qDB89AhgPXHoxI9je/SD1Jp6oEggXlAPq imEPJw1CdXNbSwUXVuhKyckmKH0MELbYWJ9RhZVxIPGy9L67XucXyT11PbHN0MzCsHmC q/0ZMPapjz9kTWMb+NdMlfCDo3Jrr3/VuNaEIkX4mcFVs2Wpthx6fe37RAELaKSvzcw2 7xiySVMiE9yMGWDeV8Y5xxu+eqGPtXPAPyfioailaDl9EhjCN05iAMnp3aXPlS7eA8gq A2xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428456; x=1716033256; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G/dRk75Xa2dli8e7P8dUDOHpTSk+dp2zsSzv4pGi5N4=; b=mGkYcV03+5t9GeIjFVrQg9MV/zKD8PldNA+TEF3Akc7KRNNMJmhM6Qunlt1tUJ2VJ4 NgW3vgb4HET8ePZUffTyg3XYpuXsTU38rP3ZIpRccJAQuCcL/CvR6HfI9DW7Ycp+y1X5 29EnWumnOibWPI76wPfPpR4/4+8dbDBtO1i0u1FVzVY0lZxdJ5Q7jwmlMVzGRPDDn3Pk 79EIkcy6bm8KOwcudcUzLjQprS5i+8IQFNJzh2G7DIXNOoaG60o9J9MTb9SeeAwXQloy Qr+eU0BTO+5LQ7zOMOsBtL3B8+LLXhlhgJpgHqHRy1q38q8jO+tD/JRwD45tshuM3vsv a8XA== X-Gm-Message-State: AOJu0Yzt/e/at2Xj716CHFeyBNkehg36jAcNKJFS1tpU2M5j8//ypH9z ddlpcR86ESCdEMPbi3jZVPoA75o0+/fYbdYWy3Cj4nyDncFcQSrB9X228K74HQXwbT5gaKOR8Nf aB4w= X-Google-Smtp-Source: AGHT+IEo1X/3tbOuwLKXh8uynojPItWy1B1ixA7c78ZF8mRgb7G66oZm8q5Gkrryh8ZirwBoV3QsXg== X-Received: by 2002:adf:f98e:0:b0:34f:4e40:c05c with SMTP id ffacd0b85a97d-3504a738b54mr3195196f8f.34.1715428456209; Sat, 11 May 2024 04:54:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 14/17] aarch64: Use bool for sve_{z,p}reg_is_eq Date: Sat, 11 May 2024 13:53:57 +0200 Message-Id: <20240511115400.7587-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428512165100001 Content-Type: text/plain; charset="utf-8" The functions results are more naturally boolean. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- risu_reginfo_aarch64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 55a9ef6..6323eef 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -268,12 +268,12 @@ bool reginfo_is_eq(struct reginfo *r1, struct reginfo= *r2) return memcmp(r1, r2, reginfo_size(r1)) =3D=3D 0; } =20 -static int sve_zreg_is_eq(int vq, const void *z1, const void *z2) +static bool sve_zreg_is_eq(int vq, const void *z1, const void *z2) { return memcmp(z1, z2, vq * 16) =3D=3D 0; } =20 -static int sve_preg_is_eq(int vq, const void *p1, const void *p2) +static bool sve_preg_is_eq(int vq, const void *p1, const void *p2) { return memcmp(p1, p2, vq * 2) =3D=3D 0; } --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428578; cv=none; d=zohomail.com; s=zohoarc; b=R80IQwUrtso9KaV//SDArOEtZ3CSVcWTHc8IEfsmiKVzmiuBlGMBRq21wrsPmQIrCw658XJQkEmFG0EXWnOYNumraOyYgJqEUaU4D/AK9Gr50rty8TSWSeJbg+QuEFHB63QK/Dxq1r3hxD/DwS5GVUfY6jYPVfQbVMGWIPxIXk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428578; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HpcdEdoUPPV0pGSNw4XA78udWGrbKRqXBRNX1k+qgFI=; b=WQYru1Dy85tNFh+clZIM7c7cOIeZBEDNUbNosbvUfnu+l5rHPeN99yMj3+HdmXaaF83VoVbxXrMV5wi2/20JChlnHVSH59NHlOEOBWbPUfs2j1zvOxho22emfBSKehQmTuM6r3SOH6qgURmQqkcAC2S61m06bTO5tixZzCQy/8M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428577815777.1408768189381; Sat, 11 May 2024 04:56:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lJ0-0000NZ-IA; Sat, 11 May 2024 07:54:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIy-0000MQ-BD for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:20 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIw-00070X-KJ for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:20 -0400 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2e5218112a6so18706701fa.2 for ; Sat, 11 May 2024 04:54:18 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428457; x=1716033257; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HpcdEdoUPPV0pGSNw4XA78udWGrbKRqXBRNX1k+qgFI=; b=GCqB3v4/zunCpwCFjyevBNANzScPlhgiENPS0Y4TbsOYRTiTDdpWhUhSksdm4NuZKb kq0LcMI5GnYRYr11t7ZR9E7AbclNDK5TsU6PMtOB4osxKx8nbltj4HXI5prG9XT4Z4FE VGiHBclEASdEu3SBd6Sg4xzCNRZrPMtod1Kh+jfVv1YbjIRPReEvMisczCghNHgMmuky 0yW/vTVk6KZbUWB+iCqatFp2qgJvi5J8GvpxQdeUcS8ZNYKmkv/yD9zQ0CJQz4gjz+wd J96owNjqN+f+j7SYxJlTzhdD7dXdD9OA1QOqasY5BwEYv7C9052cbc5oBS1wYsbkEa45 9WDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428457; x=1716033257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HpcdEdoUPPV0pGSNw4XA78udWGrbKRqXBRNX1k+qgFI=; b=v3zNriyAhHNM0jM/ENoyVfqktVUhTRUZxi/YJXBG49WOyjUCCklP7mIwQ0/gMm/xTz 73bLRALby0uJCrYpQ+c98dv9WMdjZZKLwl+WwtzBRoFrUhW0PXpax3EOs/+mRDjfxP60 52mTQaw/NnqOeJnHPnfTx/PNti9peRl4ZQE92/apIchxrZvGm1BaSwKA5iOSzUHgs7M2 iEgHWeLgrM8KrTIoeEI5XaaP0GkhWDccJFtGz1ypfqfx4m9zTqnfy3V/7tfMjCCOz/PA i62bqrxChpj6bqU/Uqg7X68e/EZ14PCu1ztfH24mfTkz31+nfmUFtYjKlbcGFlEKzytn wi2A== X-Gm-Message-State: AOJu0YyAiXWY1kYwep2aWBblHMBTJ6SCAqfL6rqIJHPMiiYNtE7hYEjL oN92qNx+ZpbGyKXwstf890FICoVlXzpDE9ordZ8nB54RZOOv1WAJ/+5QSewPAFaKZk+BRutVQlV 6JX8= X-Google-Smtp-Source: AGHT+IGx81vB/JJP5fudw8OsZJWVoabCGGS0f6VSU4LywGDIHddoFzD7onoYIPCjDy3US4ZPYvteTg== X-Received: by 2002:a2e:9b4e:0:b0:2e1:bb65:8306 with SMTP id 38308e7fff4ca-2e5204b1d89mr31245551fa.44.1715428457056; Sat, 11 May 2024 04:54:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 15/17] risu: Allow use of ELF test files Date: Sat, 11 May 2024 13:53:58 +0200 Message-Id: <20240511115400.7587-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428578451100005 Content-Type: text/plain; charset="utf-8" By using elf files, we make it easier to disassemble the test file, to match comparison failures to code. Signed-off-by: Richard Henderson --- risu.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/risu.c b/risu.c index c28b4a5..e3845f6 100644 --- a/risu.c +++ b/risu.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include =20 #include "config.h" #include "risu.h" @@ -371,6 +373,57 @@ static void load_image(const char *imgfile) close(fd); image_start =3D addr; image_start_address =3D (uintptr_t) addr; + + /* + * TODO: More complete parsing of ELF file, verify assumtion, namely: + * Single PT_LOAD covering the ELF header, code and data. + * For now, simply update image_start from the elf header. + */ + if (memcmp(addr, ELFMAG, SELFMAG) =3D=3D 0) { + const unsigned char *e_ident =3D addr; + bool swap, is_64; + + switch (e_ident[EI_DATA]) { + case ELFDATA2LSB: + swap =3D __BYTE_ORDER !=3D __LITTLE_ENDIAN; + break; + case ELFDATA2MSB: + swap =3D __BYTE_ORDER =3D=3D __LITTLE_ENDIAN; + break; + default: + fprintf(stderr, "%s: Bad elf header: EI_DATA =3D %x\n", + imgfile, e_ident[EI_DATA]); + exit(1); + } + switch (e_ident[EI_CLASS]) { + case ELFCLASS32: + is_64 =3D false; + break; + case ELFCLASS64: + is_64 =3D true; + break; + default: + fprintf(stderr, "%s: Bad elf header: EI_CLASS =3D %x\n", + imgfile, e_ident[EI_CLASS]); + exit(1); + } + + if (is_64) { + const Elf64_Ehdr *h64 =3D addr; + Elf64_Addr e64 =3D h64->e_entry; + if (swap) { + e64 =3D __builtin_bswap64(e64); + } + image_start =3D addr + e64; + } else { + const Elf32_Ehdr *h32 =3D addr; + Elf32_Addr e32 =3D h32->e_entry; + if (swap) { + e32 =3D __builtin_bswap32(e32); + } + image_start =3D addr + e32; + } + } } =20 static int master(void) --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428668; cv=none; d=zohomail.com; s=zohoarc; b=RP2PPieuMkG5iDCIbm3Kf5z85bEcYGSrviJhl/Cuu+qrHQ+sMsmdK+dr6zThpcFd2s0kOgtrgjX9LG9pvZzg3P0+QzHtH1QGdtdMMsZlvkhZHyttDNgmt6zUutQ2uzywt4dMZAbMu3fFvQ4baDhyETOZ9zAfglQscEnU8APT6Uc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428668; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LlF/qVnfBB0/mvdhSrl0HFniC4poDP63wiS0TvU6Y90=; b=cd+hnyJN0BW/tfYVfg8WAEGC3+z8iwJcUDg99hoKn+B0Tfzl2jj3AVSb+AMwMg8TnyY84w6h/eskcf1mqDutR7J33f5T2D20Kv8KSYWq8W5E1VjSrertAhQmb/G34nzHOzLGeM0xYkFjJVu5/5SVF578ER0HczkvIF7Ot9CezEw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171542866859687.32339280182805; Sat, 11 May 2024 04:57:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lJ0-0000Nb-UX; Sat, 11 May 2024 07:54:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIz-0000Mu-6G for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:21 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIx-00070i-NO for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:20 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-34d7d04808bso2029923f8f.0 for ; Sat, 11 May 2024 04:54:19 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428458; x=1716033258; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LlF/qVnfBB0/mvdhSrl0HFniC4poDP63wiS0TvU6Y90=; b=fic8w32TpSa2js6kN7tOih53aYku+zDAQ/KMgdT0Ig5cHW76WyH7CeguWeAL1IIscU DBf4PjV1u9a6st8P6vBb2Dm4LXN4HD0TDYIhL4KfEzfkKNNnxesWyMe+FZd+hD96biu7 /lbwG8uUIaFKzJ0NtqryD2JITJvPu63No4NjuuFTnTuen1KyNI/Jtqln0XkCRMrgc7Ed QYwwnd94m9a8X4PcNJ0yWefndcAkyno4wPL4cywC/B9ZHkUASr28wsxhKLo/En0gyK35 Em46zaLV5Fw28yyNOyqs2w1ikpy9odHgact+ntoSCCAcxIMrCbG4ljMAY/+eg8dTdc0E 2hSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428458; x=1716033258; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LlF/qVnfBB0/mvdhSrl0HFniC4poDP63wiS0TvU6Y90=; b=DJ/g44ZVlah59IeDmiYJmt1IdjiXoaMRWQOHUOAu9RH6nqH1m+pxFu9XvpmidP0ixc 7ibAhTLSGQeW03QuVJ3vpBOQJmxQU/FSrW+ucVpUsbxtA7V2VANPN7rCOpCOPsv3vHUE J3dZnezCB3y4fn4f8Y0rZEM4YVtxbd8EYrefj1FDjgJS2u2qNaasFZRfMf7yCsEnXKPf g7AELr1whxxyNfS488dZ3tZ9pYBO4y7HNqcHflsm36QsMzx+cWteRIliL+IPDZdIhM9e +jOqx9xJb0ylk8bw0FSp8l3R576OkRDVkK0TS9Qhz+f42PWh1TeILP0r4D9P7aaVvOjy 1/4g== X-Gm-Message-State: AOJu0YyidRH4tY17aRyJ7VrINWUXjgR3Jhzb55cDtZVTNKeY4a5RTNa8 h6wU/vZS2mpechi/pp1Ukk3pf7lxOlG3sIUr1ImKAnZgATO3sm1rsmb32pfaa/856fLEodfWD/z VelE= X-Google-Smtp-Source: AGHT+IHdyFMhOQnxoXVFaqs77mBMeqYqKKdp6nqtc4FvoJCSoFgRLASw7wogaN53Jpz4WlVDg7nd7A== X-Received: by 2002:a5d:6650:0:b0:34d:7f17:1e22 with SMTP id ffacd0b85a97d-3504a61c818mr4198469f8f.14.1715428458340; Sat, 11 May 2024 04:54:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 16/17] configure: Enable loongarch64 Date: Sat, 11 May 2024 13:53:59 +0200 Message-Id: <20240511115400.7587-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428668918100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2f7c580..39275a2 100755 --- a/configure +++ b/configure @@ -54,6 +54,8 @@ guess_arch() { ARCH=3D"arm" elif check_define __i386__ || check_define __x86_64__ ; then ARCH=3D"i386" + elif check_define __loongarch__ ; then + ARCH=3D"loongarch64" elif check_define __m68k__ ; then ARCH=3D"m68k" elif check_define __powerpc64__ ; then @@ -141,7 +143,7 @@ Some influential environment variables: prefixed with the given string. =20 ARCH force target architecture instead of trying to detect it. - Valid values=3D[arm|aarch64|m68k|ppc64|ppc64le|s390x] + Valid values=3D[arm|aarch64|loongarch64|m68k|ppc64|ppc64le|= s390x] =20 CC C compiler command CFLAGS C compiler flags --=20 2.34.1 From nobody Mon Nov 25 10:48:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428559; cv=none; d=zohomail.com; s=zohoarc; b=KWeriQh8YYkD6rWkR6wCBQHGnRQoxyjIfIyt8KXQ9CBxH1NXDfB2omokZXPkeXRdYBKgNVWjFigs9SPZaw2eEGSUvsOi2l2vpNm9QztlFINI3VD0RFOFR9wA0UTq+qL9lDWyeoKJCLMq/i7r1b7ALnOJkMg9zzQGpTKfhPYEUb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428559; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gCHqJdB9ixZnMzJUa7fmPKgSiCmh3gi3e9Ib/ZnK7PQ=; b=IiOEf92qqKFZ2GIees6ar0ThPb5g1k+jDzUVmDsymnltq/mFW2g/itDRhOuD5kXpZItIZLJa4kv8rx3wswDtweRm11PIwvP59e5DG7EzdEubdY4oekqukw7WQa6pqkRF6UtuIbZXbXczyd/PQFEbszp1QTUSZx0xa2WTPfv2RH4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428559494809.8268905653186; Sat, 11 May 2024 04:55:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lJ3-0000Oe-5m; Sat, 11 May 2024 07:54:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lJ1-0000Nj-GI for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:23 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIz-00071b-H2 for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:23 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42011507a57so1010625e9.1 for ; Sat, 11 May 2024 04:54:21 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428460; x=1716033260; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gCHqJdB9ixZnMzJUa7fmPKgSiCmh3gi3e9Ib/ZnK7PQ=; b=Gk3hBFc1fwY4kmjOxkUp2fuK/DVt7CdZ08AzShOwLu4i8VCGn193rLhkE9eoKHWqTf h6LcTRayyzWw6quagaSU95DjEdNKjsbpJPFa92y3k3B7BR8FkZt2WtEVnNF+k9nhGz/U X4YgOimSW77vLv5KMwiHT26F2MK5SfJDbYp5U7uLtnP2CNFvBSY4AUYT9vIgRISXtAkA 8uTF8OcBX5AjxWGOReTTYOHaA4vb+UuSuJBbRQB92eoL5RbP3KYHAFLisG4zAvBqdTZq g0rbEmjOLDsEvcZeQY+GYWvBEY4UUUPjHr8WukiQISlOvbq/d4j7f72V5Krrl8zVf1yd YnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428460; x=1716033260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gCHqJdB9ixZnMzJUa7fmPKgSiCmh3gi3e9Ib/ZnK7PQ=; b=W+ivb8OCjQb7LwupR0VhCl/Aclc7W4slhx7PBqFZ1nZjt66OfCTPsSGSH8v0tGjYDq mEIadIM6BVYpY83lGy18eb41+RZtw1Xbyc2ufRbXKxpIniry+TjvNSX/4X4ZCJ+M3bEg W1EybgrNVsKvbEJl7VGa72Wv8G6aiusyUGf5CjJRmLBk2GY5F3gupdDBzvhIoubHDD5c pkB6cFsps3cERcOqgFtHSi5/1+Ir6R4n6JS0PlcGUKX5AJJP7ceMZEmjx0kxw7+Fh1Cp /8XkTX4aNilA48Ws0TXRtMi9Tz3YdvPcqIs5vRQK7RApCer4nUO3nNX/PSok0IPq8pXU DRLQ== X-Gm-Message-State: AOJu0YzHc8EWaJTaGtniYjlwiwP60tcxftJQD9htp0CeuZNmxB1ygFla JU1sOcjovC1a7lwSN77NoFqiLOY6/yL1nk7zIFtz2HBxdBrHVySp6UC1afUDrEQjYTWqrmYISYT uQBs= X-Google-Smtp-Source: AGHT+IGq8X4lk2DcwJEgT85HN3jMTQ5QCFvjiCA3kHJXqYEuMkjg0CFOMAfL8PjWIlICp6dD+gmgsA== X-Received: by 2002:a05:600c:a45:b0:416:bc18:2a00 with SMTP id 5b1f17b1804b1-41feac5a4d9mr42804905e9.38.1715428460156; Sat, 11 May 2024 04:54:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 17/17] Build elf test cases instead of raw binaries Date: Sat, 11 May 2024 13:54:00 +0200 Message-Id: <20240511115400.7587-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> 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: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428560348100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Makefile | 19 ++++++++++--------- test.ld | 12 ++++++++++++ test_aarch64.s | 4 ++-- test_arm.s | 16 +++++++++++----- test_i386.S | 4 +++- 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 test.ld diff --git a/Makefile b/Makefile index ad7f879..2bd08aa 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,8 @@ ALL_CFLAGS =3D -Wall -D_GNU_SOURCE -DARCH=3D$(ARCH) -U$(A= RCH) $(BUILD_INC) $(CFLAGS) PROG=3Drisu SRCS=3Drisu.c comms.c risu_$(ARCH).c risu_reginfo_$(ARCH).c HDRS=3Drisu.h risu_reginfo_$(ARCH).h -BINS=3Dtest_$(ARCH).bin +BINO=3Dtest_$(ARCH).o +BINE=3Dtest_$(ARCH).elf =20 # For dumping test patterns RISU_BINS=3D$(wildcard *.risu.bin) @@ -30,7 +31,7 @@ RISU_ASMS=3D$(patsubst %.bin,%.asm,$(RISU_BINS)) =20 OBJS=3D$(SRCS:.c=3D.o) =20 -all: $(PROG) $(BINS) +all: $(PROG) $(BINE) =20 dump: $(RISU_ASMS) =20 @@ -43,17 +44,17 @@ $(PROG): $(OBJS) %.o: %.c $(HDRS) $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $< =20 -%_$(ARCH).bin: %_$(ARCH).elf - $(OBJCOPY) -O binary $< $@ +%_$(ARCH).o: %_$(ARCH).s + $(CC) -o $@ -c $< =20 -%_$(ARCH).elf: %_$(ARCH).s - $(AS) -o $@ $< - -%_$(ARCH).elf: %_$(ARCH).S +%_$(ARCH).o: %_$(ARCH).S $(CC) $(CPPFLAGS) -o $@ -c $< =20 +%_$(ARCH).elf: test.ld %_$(ARCH).o + $(LD) -o $@ -T $^ + clean: - rm -f $(PROG) $(OBJS) $(BINS) + rm -f $(PROG) $(OBJS) $(BINO) $(BINE) =20 distclean: clean rm -f config.h Makefile.in diff --git a/test.ld b/test.ld new file mode 100644 index 0000000..eb0a76a --- /dev/null +++ b/test.ld @@ -0,0 +1,12 @@ +ENTRY(start) + +PHDRS { + text PT_LOAD FILEHDR PHDRS; +} + +SECTIONS { + . =3D SIZEOF_HEADERS; + PROVIDE(start =3D .); + .text : { *(.text) } :text + .data : { *(.data) } :text +} diff --git a/test_aarch64.s b/test_aarch64.s index f75d588..88902c6 100644 --- a/test_aarch64.s +++ b/test_aarch64.s @@ -80,6 +80,6 @@ fmov d31, #31.0 /* do compare. * The manual says instr with bits (28,27) =3D=3D 0 0 are UNALLOCATED */ -.int 0x00005af0 +.inst 0x00005af0 /* exit test */ -.int 0x00005af1 +.inst 0x00005af1 diff --git a/test_arm.s b/test_arm.s index 49552f2..62582e7 100644 --- a/test_arm.s +++ b/test_arm.s @@ -9,20 +9,26 @@ * Peter Maydell (Linaro) - initial implementation *************************************************************************= ******/ =20 +.text + /* magic instruction to force ARM mode whether we were in ARM or Thumb bef= ore */ -.int 0xe0004778 +.inst 0xe0004778 + /* Initialise the gp regs */ add r0, pc, #4 ldmia r0, {r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r14} -b next +b 1f + .int 0,1,2,3,4,5,6,7,8,9,10,11,12,14 -next: + +1: msr CPSR_fs, #0 + /* do compare. * The space 0xE7F___F_ is guaranteed to always UNDEF * and not to be allocated for insns in future architecture * revisions. */ -.int 0xe7fe5af0 +.inst 0xe7fe5af0 /* exit test */ -.int 0xe7fe5af1 +.inst 0xe7fe5af1 diff --git a/test_i386.S b/test_i386.S index 05344d7..2e2b090 100644 --- a/test_i386.S +++ b/test_i386.S @@ -13,6 +13,7 @@ =20 /* Initialise the registers to avoid spurious mismatches */ =20 +.text #ifdef __x86_64__ #define BASE %rax lea 2f(%rip), BASE @@ -71,7 +72,8 @@ /* exit test */ ud1 %ecx, %eax =20 - .p2align 16 +.data + .balign 16 2: .set i, 0 .rept 256 --=20 2.34.1