From patchwork Sat May 11 11:53:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796222 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1235804wra; Sat, 11 May 2024 04:54:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtgxJ9As9aasRqMxmPuOxYIpT7SP12sTVL6Y1jCsG1QgxYHRsy5AEmnLhUyB1MIpEje79p0HUc9ZJ7/6E1rM7h X-Google-Smtp-Source: AGHT+IEu+gvcAMx+gpLJOdXqyNgCnL+3fpQjsHjpktfLvGXFs4CoRpsXOKY1fHagTgIEi2WpGW34 X-Received: by 2002:a81:92d6:0:b0:615:f53:64de with SMTP id 00721157ae682-622affcebefmr52220107b3.29.1715428487145; Sat, 11 May 2024 04:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428487; cv=none; d=google.com; s=arc-20160816; b=ugmTZkhG4HUJuYNgxS3VkxYiVXHehPo3KD6pyA3f1tGZh0ERYy2a6Wc0c5zWG10Op7 ggeiV5bU6b0Mbqq9hcnxfe/xXMjIV16Ztq7hfT9sXOHzcAax2Mt5RJsRiuKm6tu6RFLS kBoyGgId3pZUnKtPz8n3UoF59QdcN48l1+/gugpdngOdvuvvz3AXabs3i/F7k0IiZjzL nhYPG5mELLiZldgPYM+zj2/IOg1TuwA2lv17VKSPv/q2Vfhf8r72bzgJOhBcJt2IZ/EJ 6H2dknBslrhsLe9gzsD+/GBE7aARTMVLOVXhuprN3rSJVW5XOd91KLE467eR5MmSmeyx mRlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M9q5UQizGwrMYMCi99D6HLSzNEy+uYysxva9bCXYLNI=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=N06TY69Ggkb6tFo2CIZ5Q0nHAnaaRod+CzTpzHOgdToPPKDOqhLPx8ThzPZNpjQIkF U0NcdvAyPZvDffYpqGkdDSEttb8nYxUU0iAs3vE6JW/kOE0Fl4/goKYYTBujq6xleBW8 3hTygk9O2fnHtzv3wYJaLZlm6UE3HjwA8Cwwi8uQOA/QNrzaw7NJHksiQvbgu2rv1dSg iXh1Jr3xuelohrizjtN5vmpJW7FMnE4lvhoxDfgBXFdGmLIvOxnfkt2aepfFePRVR93T vvGFPMf6gDl357rn1yguepoR7zgYXoHojzCcDlUmxHQAkybcjWQlZ5G0rfhDQBF5plnu ztcA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f6Ax+JFy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56d56d5si55703651cf.676.2024.05.11.04.54.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:54:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f6Ax+JFy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 *****************************************************************************/ -#include - #include "risu.h" +#include void advance_pc(void *vuc) { From patchwork Sat May 11 11:53:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796225 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1235958wra; Sat, 11 May 2024 04:55:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXEBS04FMvhR05ks8SQI+9V0SOOdLEzTydDdebmknxiyJUYlN0fQ10V5fA3SVqSwr2rhi0VxB6Ju0HV2QKqP7M4 X-Google-Smtp-Source: AGHT+IHztjZy26TPqKL53dsUQj8wsNDYf5emBNXnXTnps0z08Uem6Oun10D0XMIWLEShDLtq8Oni X-Received: by 2002:a05:620a:2197:b0:790:9823:190b with SMTP id af79cd13be357-792c75774eemr534298385a.16.1715428524214; Sat, 11 May 2024 04:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428524; cv=none; d=google.com; s=arc-20160816; b=NEjzQyJt9g1JXHFvaEPj64wavv56baS5i/lvWpc3Bdoe2Q+Za7C6T/BFeLoNNmCdzx qIe9gqPwfrjFWpLEJgeE1Ot6ANVW95UZXztd+tesnJMzNf93jq0mWMHssqqHCe+XM6Fo uDZcpWuMBjQqUJ+LsvVBHtk3+deCkkcGnDIqCAyNcnZCYrNYpF93uIdzkVDwnVjgkAZ6 nIIUI0hpYdsCRJNfDqeusw3/ks/O50aqG0Q9yh+8mnp4NRaliuylSBWA8E+E8ToOeha+ OSx649B503uzYGcRO1uqk21wn+iQUqGmBd1IJDEMTrzvdYJzN1mqhsjypo8P4bBWmXex /ReA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+j17CWT0LGOl4p0U3kdloXB6QscEHqrtuA6J/qKLXl4=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=XRuDJi9m9CyNH4iPeU4L/yyQTeSqrL2rC0/tQvIN0Ka31CXLEcfRDhvzUBNMU7zvyD qArZ9vIZG62Zhr391ENBQFh7IDXY3Y0Kh94JWo8nktMqEt/XqU8jS4QTo9BBo0liE15r DglkllPVFj79tewMBYhZoG/C0cEpg9Tjtfducmt6MWIei2ttTK2drzmEvpED+Jy4al3J mkjaihU2wE9uLvpbJqSMeaH54IrEGSA8vWfZDZITS0Y48YzOMmKYlhK+9MrGWy2PQBlY ql3Mt8TN+Cc5raVKbl7tbN7o0w5UnEUbgIVUTN+cKLSkpoCHoWKVtjyim75X9My1dVB8 0R+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vVHqsLXP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf30b244si548638785a.352.2024.05.11.04.55.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vVHqsLXP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org mmap does not return null on failure, but MAP_FAILED. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 = - mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, - 0); - if (!addr) { + addr = mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, fd, 0); + if (addr == MAP_FAILED) { perror("mmap"); exit(EXIT_FAILURE); } From patchwork Sat May 11 11:53:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796237 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236290wra; Sat, 11 May 2024 04:56:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVHROR9yS0a39G8hAIalqnCS3rioYoCL8sS6Df63zmH3H4qvzJmrqipscmZnUVAia3pMug0Kj5wL9iUvxA2bQMC X-Google-Smtp-Source: AGHT+IFcY0+S0CdrxNm/JzNRrdtIs/jXKf/1Bf9/s04kf6XQaHWlvQ7drQXAYm0x8ndSmdovICTr X-Received: by 2002:a05:622a:1314:b0:43d:faca:1011 with SMTP id d75a77b69052e-43dfdd21e6bmr62570141cf.63.1715428603281; Sat, 11 May 2024 04:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428603; cv=none; d=google.com; s=arc-20160816; b=sn6/+EQHWZebCjMQpHuJXJ7t1CVSgKepRNCCnb6/09gAKj+gQkoXy0hLVmfAKMPx1m qZEWsPUChPkSzh2qotHGNYrSc86a48DF+jw5JfVfjI0tLhEDklQ3CQMJAGGvI+zBO6ZU sF2847YaaNjoA/6D+GfHKgkfiO8A2S5/wXP0pauNuA2rH1ygZZPtzaNGVEdMppJqDrzz B/aC7yYq4dauByBBsHnvuR4d1DnP6XrMLVd55Q8g5ICgqLn6myT5NwHIBIuChEoXpESc /10PB5LPV3QTL+GnZP2iERzm8ASGtUMIMFvtEAsLU1omlY0X3Uj6uArYcc/KrWzi32Hg xlow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9nf//qjvXctRXrrQe7LSzMsk4uBFI3ROnap3D79JgrM=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=Y/PMLk7tjxGfm5Fm+ZHco2lYBxVqC3Mdnnu6PkuXQU0/71BCXN/Ljp0FDVAxR46VT5 Hxa5zizfKT/IUyzLmpWSNDwf+eKWwgu0FjlTuFKXbZjJR9EeFRVGNYvKn0PKLh5c1wWz p7t/9BRSIDf0vclToiW7xx4Nx9XHjuM8IXNQR9jhnXrL+H8INc75yDQD4yyZryZyhh6J r76UOaujj1lWKM6NM7zzuo6cUSniPkCY9MN4LnSlOBhT4W43g1K5WPSQdA+N8Q1GFppx pomoiGbZl38xA5+BxA2se3WxKUlU4OkQcbrk1qJnoAJNm7c+f2aOifEuOIAR0QZggBrR OTrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bnQGp7Qm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56d42ffsi59391371cf.667.2024.05.11.04.56.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bnQGp7Qm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 *r2); /* print reginfo state to a stream, returns 1 on success, 0 on failure */ int reginfo_dump(struct reginfo *ri, FILE * f); -/* reginfo_dump_mismatch: print mismatch details to a stream, ret nonzero=ok */ -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); /* 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; 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); } -/* reginfo_dump_mismatch: print mismatch details to a stream, ret nonzero=ok */ -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 != 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 = 0; i < 31; i++) { if (m->regs[i] != 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 reginfo *a, FILE * f) sve_dump_preg_diff(f, vq, pm, pa); } } - return !ferror(f); + return; } for (i = 0; i < 32; i++) { @@ -356,6 +356,4 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *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); } -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_size != 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 != a->faulting_insn) { if (m->faulting_insn_size == 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 = 0; i < 16; i++) { if (m->gpreg[i] != 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 != a->cpsr) { fprintf(f, " cpsr: %08x vs %08x\n", m->cpsr, a->cpsr); } + for (i = 0; i < 32; i++) { if (m->fpregs[i] != a->fpregs[i]) { fprintf(f, " d%d: %016llx vs %016llx\n", i, @@ -216,9 +217,8 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) (unsigned long long) a->fpregs[i]); } } + if (m->fpscr != 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); } -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; - fprintf(f, "Mismatch (master v apprentice):\n"); - for (i = 0; i < NGREG; i++) { if (m->gregs[i] != a->gregs[i]) { assert(regname[i]); @@ -399,6 +397,4 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *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); } -/* reginfo_dump_mismatch: print mismatch details to a stream, ret nonzero=ok */ -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"); if (m->vl != 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); } if (m->faulting_insn != 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 reginfo *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); } -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; if (m->gregs[R_PS] != 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]); } @@ -133,22 +132,18 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) continue; } if (m->gregs[i] != 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]); } } if (m->fpregs.f_pcr != a->fpregs.f_pcr) { - fprintf(f, "Mismatch: Register FPCR\n"); - fprintf(f, "m: [%04x] != a: [%04x]\n", + fprintf(f, " FPCR: %04x vs %04x\n", m->fpregs.f_pcr, a->fpregs.f_pcr); } if (m->fpregs.f_psr != a->fpregs.f_psr) { - fprintf(f, "Mismatch: Register FPSR\n"); - fprintf(f, "m: [%08x] != a: [%08x]\n", + fprintf(f, " FPSR: %04x vs %04x\n", m->fpregs.f_psr, a->fpregs.f_psr); } @@ -156,14 +151,10 @@ int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) if (m->fpregs.f_fpregs[i][0] != a->fpregs.f_fpregs[i][0] || m->fpregs.f_fpregs[i][1] != a->fpregs.f_fpregs[i][1] || m->fpregs.f_fpregs[i][2] != a->fpregs.f_fpregs[i][2]) { - fprintf(f, "Mismatch: Register FP%d\n", i); - fprintf(f, "m: [%08x %08x %08x] != 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); } -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 = 0; i < 32; i++) { if (i == 1 || i == 13) { continue; } - if (m->gregs[i] != 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]); } } if (m->gregs[XER] != a->gregs[XER]) { - fprintf(f, "Mismatch: XER\n"); - fprintf(f, "m: [%lx] != a: [%lx]\n", m->gregs[XER], a->gregs[XER]); + fprintf(f, "%6s: %016lx vs %016lx\n", + "xer", m->gregs[XER], a->gregs[XER]); } if (m->gregs[CCR] != a->gregs[CCR]) { - fprintf(f, "Mismatch: Cond. Register\n"); - fprintf(f, "m: [%lx] != a: [%lx]\n", m->gregs[CCR], a->gregs[CCR]); + fprintf(f, "%6s: %016lx vs %016lx\n", + "ccr", m->gregs[CCR], a->gregs[CCR]); } for (i = 0; i < 32; i++) { if (m->fpregs[i] != a->fpregs[i]) { - fprintf(f, "Mismatch: Register f%d\n", i); - fprintf(f, "m: [%016lx] != 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 reginfo *a, FILE *f) m->vrregs.vrregs[i][2] != a->vrregs.vrregs[i][2] || m->vrregs.vrregs[i][3] != a->vrregs.vrregs[i][3]) { - fprintf(f, "Mismatch: Register vr%d\n", i); - fprintf(f, "m: [%x, %x, %x, %x] != 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); } -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; if (m->pc_offset != a->pc_offset) { - fprintf(f, "Mismatch: PC offset master: [%016lx] - PC offset apprentice: [%016lx]\n", + fprintf(f, " PC : %016lx vs %016lx\n", m->pc_offset, a->pc_offset); } for (i = 0; i < 16; i++) { if (m->gprs[i] != 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]); } } for (i = 0; i < 16; i++) { if (*(uint64_t *)&m->fprs[i] != *(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]); } } if (m->fpc != 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); } From patchwork Sat May 11 11:53:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796233 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236249wra; Sat, 11 May 2024 04:56:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWKyT9Ddi5gUyBtMlg9Gwsx18mag5/C/5i64D4Xlrrl+y97Y1uEETKIVazW05u2K3lb7CPbwR14ifdR6A95tmmE X-Google-Smtp-Source: AGHT+IH2tGPIq4POycczFaHKL13RWA8H11zXjzKjxfW6I4aji5JHGe7Z9TwcbANll2kwybV9AXAc X-Received: by 2002:ac8:574d:0:b0:43a:ee9f:8ff0 with SMTP id d75a77b69052e-43dfdb70bc2mr64683321cf.38.1715428593725; Sat, 11 May 2024 04:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428593; cv=none; d=google.com; s=arc-20160816; b=0iHHuFBhkWNn2pJdL6lD8m4VwUizVHPyX4tSDupzxvyOnDOssiV5Ps+j8Od9uJDF8Z YLHooUyRfpL83Y019kP8txiDatq474DFLGmV0TSSSgwS4lO+Yz+kGIfhi6H5+XdFcr6i RK7bsC44j6US1Vy4FRL00qY1CqdgRqxI1pq0yBmgmZ3HbwFcQy3pgmE8ICi8kGtMlF1J nOx8Kk81oebY4t5Fp4c95sSGC/ZqMqMO6fcBGdDS7jT6b5UWfgMv9pyhijqzf6sW8tXB rvuHWkMrG1ScvRz8ZGFQ83A+ShV7wY2AnZshUjb4StsvWk+IIHB28j75aYff+NYUlzGp K0Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3X3XgI50snZLtrZ7HC0OWfW96V7yOplWwRGvCG/f16A=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=HJnvfFywS7ywoLpt5YHA8P+CN8qH4Li9jhaA/QdNwOtiW6z18zD75ZMR5sE85BpiKq v2GiE+28/+99Bt2Q06xypy0rxnraIkmq01ZHY/+o0MisuiqaRqDnu/q3yrMIgRTI/IaQ UWI43vjib+YbO+BZF0RJrR2xRVt/SbD8CeVexmeBJ4LFma+Ul14zEvk3nFjnc6jmsxR0 Y7yAxgSfaqttUmpS3DQO2qr+XDMpm8LHF4LIAl4cWZN5waEkor3iwb/bGjsgAk5ziAfh pni+hwj7hjUiVz2EgggAhV4bQqlnuQ5IbqWP8LZrVt45FGDl3I17qHHd6TFpPw/wvMP4 v+4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oy7HA8sT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56e6078si55827451cf.764.2024.05.11.04.56.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oy7HA8sT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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) } } -static int ismaster; +static int dump_trace(bool isfull) +{ + RisuResult res; + int tick = 0; + + while (1) { + struct reginfo *this_ri; + + this_ri = &ri[tick & 1]; + res = 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 == 0) { + reginfo_dump(this_ri, stdout); + } else { + struct reginfo *prev_ri = &ri[(tick - 1) & 1]; + + if (reginfo_is_eq(prev_ri, this_ri)) { + /* + * ??? There should never be no change -- at minimum + * 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 == 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.magic); + 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 = DO_APPRENTICE; 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=FILE Record/playback " TRACE_TYPE " trace file\n"); - fprintf(stderr, - " -h, --host=HOST 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=FILE Record/playback " TRACE_TYPE " trace file\n" + " -h, --host=HOST Specify master host machine\n" " -p, --port=PORT Specify the port to connect to/listen on " "(default 9191)\n"); if (arch_extra_help) { @@ -511,7 +589,9 @@ static struct option * setup_options(char **short_opts) { static struct option default_longopts[] = { {"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 = &default_longopts[0]; - *short_opts = "h:p:t:"; + *short_opts = "d:h:p:t:"; if (arch_long_opts) { const size_t osize = sizeof(struct option); @@ -551,6 +631,7 @@ int main(int argc, char **argv) struct option *longopts; char *shortopts; stack_t ss; + bool ismaster; longopts = setup_options(&shortopts); @@ -586,6 +667,8 @@ int main(int argc, char **argv) } } + ismaster = operation == DO_MASTER; + if (trace) { if (strcmp(trace_fn, "-") == 0) { comm_fd = ismaster ? STDOUT_FILENO : STDIN_FILENO; @@ -609,6 +692,10 @@ int main(int argc, char **argv) } } + if (operation == DO_FULLDUMP || operation == DO_DIFFDUMP) { + return dump_trace(operation == DO_FULLDUMP); + } + imgfile = argv[optind]; if (!imgfile) { fprintf(stderr, "Error: must specify image file name\n\n"); From patchwork Sat May 11 11:53:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796223 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1235802wra; Sat, 11 May 2024 04:54:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZikqsrIuWvgRMpkPVreREk/TTsoasySeZiCGyEuxNiqVGzva1SbVY12Yvi+lUSQYkzRUP2cMn6+cHJYqYLNAS X-Google-Smtp-Source: AGHT+IFPxrS/K1tZhyg000BRHfARXo7wA7aHEHS0f5X5xNgVxjXlcLX4vTWJOIoxY8FWmUgaTid2 X-Received: by 2002:a05:620a:a93:b0:792:cd03:2fbc with SMTP id af79cd13be357-792cd032ffemr360579485a.8.1715428487165; Sat, 11 May 2024 04:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428487; cv=none; d=google.com; s=arc-20160816; b=yUdWAE+Ppm3irTNkmF9bky6MqSVL+zFk0cB76BHsBWVDB+cTIC+nT8upOqGUpQ/Xo1 z6wrtT3XMYb1EROCE47s6QlCSC7Gx5hXQgyOpftnqp7Q67zQ/9wapDtZvwdo83MLLfXK FktekekyPtDey4pXbGrcTMCPgSYmmooJqfFYv2OjkvJd4Vg2xhdYLMyKxp3r70yDvA7w FHeLEROavZoXH0f/6KOpFIYhcbleAbEGD2p05OxnhuKXv3empHsEi62z5XuvqE8AtTmB zclak56xXdHPEkEll4jqKnv4uTzndwsB/m+KbiVKKpEs1kY88F5GbGZCB7Vab4ASszwW +eIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m32BdCDoIDtUZU97rjMJn0R/q9fXLMgEs1BlUjCyWs4=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=w6vocGklnDYByL/qb6kPDa2W41+w9BtS7uXEM1LHQbsvb8CaiO/9e0VmqV+ar2mwNr F4yHGpohyidR48wb4EYVU3B9qOPRldYYh4Z3Hn0NDxM7qyZAs3K9y3WXb3VKMkOx2tu8 ad/HWXKP7zeWMi8ysW8xI7SX6dp8NR1NyjA/savY33Ebu+oxLFYRKZHYM8+Ps3RJHOrb j6fER/Xm8dKXTK0ONQc3+KZIxxSuDmhqUVsi8t3BAJHeTccHkoD0g5ub7CIJCFIJQbw0 /CdvnVG+01tCeynB2O22LKcMbYVKkpRrhS8ZRDoIs/P/gfJi4WXamEhGsmId9srbLyXX oLBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oB1R5M0v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf33b13dsi602958285a.451.2024.05.11.04.54.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:54:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oB1R5M0v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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, void *siaddr); /* return 1 if structs are equal, 0 otherwise. */ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2); -/* 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); /* 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 uint64_t *za, } } -/* 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; } for (i = 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); } 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 *r2) return memcmp(r1, r2, sizeof(*r1)) == 0; /* ok since we memset 0 */ } -/* 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 == 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); } 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) } } -/* 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); } 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 *r2) return !memcmp(r1, r2, sizeof(*r1)); } -/* 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); } /* 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; } -/* 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) } fprintf(f, "\n"); - - return !ferror(f); } 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; } -/* 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; @@ -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); } 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)) == 0; } -/* 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; @@ -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); } void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) From patchwork Sat May 11 11:53:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796231 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236179wra; Sat, 11 May 2024 04:56:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzp7k7/E80OK/E+aLoB1Lsk0IKBrQ2uAZvlADKbkHXWGu/OAlSG3bcMhXy4qUIgHYTHwH5CaJdbieW6Z2mw3qv X-Google-Smtp-Source: AGHT+IHULaVK0VQzxG+WOhGDte2aM9esctz95VN1aBAMPUKHlqB82KoapG9aYB2M9z+v0YWHTFVt X-Received: by 2002:ac8:5a8c:0:b0:43a:ea41:c9cd with SMTP id d75a77b69052e-43dfdb70c38mr65563091cf.59.1715428574522; Sat, 11 May 2024 04:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428574; cv=none; d=google.com; s=arc-20160816; b=OOSdqpPVoTU+gkbr8HyPs3Muc8Hzowk/+ZDxsdGNd39wN9o4JbXNmx4N4bSalh+9nT 2do5T9P6rOGE10XAMB9v/t/aM0qCyj953kH35QSdZx6esI0HakRDB/nnN/Yw5N4eLd5c jwx+4Vo+ysGc1OEQ+uCrKRi6bpYc8Yxa3Bmrwur2hVQiTwsXl9jdVwXQcy8MjhLHrCWF q1hZfAllVwB2x56dzulw3BhcNt1IWvycKAR/rLw50PymGLyc5qE0vJo/PE73KuGjedKF MNz/tYw4Rg+UZvpJrZdF998PamZwSTnFO7VEf0GKjLytNvnlZuJUEcl8l3Pw9IdNdjTF vyAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=FFhsnpuR0T6Oz3VeefiVv+x4D6J+3axv5iSMdWyux4hd+e/z7ndehj9a2mEGNoftOx 18U4LjpKT3X35ZrrZlcKLKlDng45uTECvo6Yiy4Bv6qq6qetockIdSvGsBH9PaN1mcUp 7JnpaAZHbfRdsssNw1En5c2TWMkS3ltkZCjdtIkt/XIl4ikI634eYPKgQxNUmGqNEHze 0x1r+dZwWXaD1Ivg/Q78lX1leDZVStFOPoxli5D2ZtRVzWTlnT1v62NbjnVa02JnvExJ xZHVNHfYBHKkDZJJcy3zT99IOhrrmSA2xqeILyZiUqd5GOL55x3atfLJqoaDzJAu8vu7 Dl4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C3i/Sm8L"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df54a1e78si60572281cf.57.2024.05.11.04.56.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C3i/Sm8L"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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)); ri->faulting_insn = *((uint32_t *) uc->uc_mcontext.regs->nip); ri->nip = uc->uc_mcontext.regs->nip - image_start_address; - for (i = 0; i < NGREG; i++) { - ri->gregs[i] = uc->uc_mcontext.gp_regs[i]; - } + memcpy(ri->gregs, uc->uc_mcontext.gp_regs, 32 * sizeof(ri->gregs[0])); + ri->gregs[1] = 0xdeadbeefdeadbeef; /* sp */ + ri->gregs[13] = 0xdeadbeefdeadbeef; /* tp */ + ri->gregs[XER] = uc->uc_mcontext.gp_regs[XER]; + ri->gregs[CCR] = uc->uc_mcontext.gp_regs[CCR]; memcpy(ri->fpregs, uc->uc_mcontext.fp_regs, 32 * sizeof(double)); ri->fpscr = uc->uc_mcontext.fp_regs[32]; @@ -69,10 +69,6 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) { int i; for (i = 0; i < 32; i++) { - if (i == 1 || i == 13) { - continue; - } - if (m->gregs[i] != a->gregs[i]) { return 0; } @@ -150,9 +146,6 @@ void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) int i; for (i = 0; i < 32; i++) { - if (i == 1 || i == 13) { - continue; - } if (m->gregs[i] != a->gregs[i]) { fprintf(f, "%*s%d: %016lx vs %016lx\n", 6 - (1 < 10 ? 1 : 2), "r", i, From patchwork Sat May 11 11:53:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796229 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236117wra; Sat, 11 May 2024 04:56:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4W5JrfrLfR+9I+GAzIUYFGeFSXAQImQ6XKaIh+23GizhXrdFXeiOzTAOehYS6EbKRfbxUiBe3ls0+FosyFFP8 X-Google-Smtp-Source: AGHT+IEPKV6jNtxhF5ULMrllJ90XX39VY1URZ0FVk0t05Fvj5BOt7KCXb6CZB17ltn6zc+k+FRUD X-Received: by 2002:a05:6214:3101:b0:6a0:a98a:4881 with SMTP id 6a1803df08f44-6a16815e375mr55344906d6.21.1715428560299; Sat, 11 May 2024 04:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428560; cv=none; d=google.com; s=arc-20160816; b=PU/jYszvc2xZX6CGiu/El1W48EKftyD8r4E5zRtFY7BJuS4Y3gSVN00ybYOfHBaTah rmzHZWbRU/0j5NMhW+uKVn6PXYxu0AaUBz/9WUYRma/6R3XCPI8lnmIFyjuG25JD64MH 7yC8fp4Ugr+FXSbfS6fBwXg1rO3+Gt2sYLWHnrMV7MYd3jBkopskt58MiEXh3PekFUY0 5GdiHMf2HQHnbtxuezc1FFBySyjMRTlH+5C8RMffs/jcxDpJaB429jW0puBc3/WVBqP0 H+IColW4w2KigtW+L74R+Df558VsAmXNdAD8JymLyw2W5t53Q8QMK2qFRjdcOM7lEN12 ug1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fK+33hG7y7qtK+XmeBcuCbI8Hmdt6nSy4YCvnmn+BlU=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=Wz756BRUgV+pUtEqwA0eFARwOfD0855vojgf1SO3/f89h2ySLzCVQv0otTyd7ZrI0v oDvC1JhCQRgaJ2PRk5roPxkFp9rErs8Scn8C/9I/mi8AUflV4SxuUiBlDnwtnz1tkREG bxMOirWXo38wrSncr2NFyhPmDNf8VkMM7cUnxJnjBhr0a2HcEdVQ336QFYSM/uOFIHHC GiUEPIxDtpbOTErefLBp5vYUMHy2y9czRYKRlLOR//WPa25J77bhcZG3kZjfKHGFa/9u Lx+Xubse4h4Da5g9ittJb30vqYznsxdybZ3IfL32V6RoVHUCv7wZO2V+K5/LvlMUDH8/ K/qw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wSlsbqcJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29a905si56239446d6.289.2024.05.11.04.56.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wSlsbqcJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org There are 32 bits in this register, and they are all valid comparision destinations. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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; } - if ((m->gregs[CCR] & 0x10) != (a->gregs[CCR] & 0x10)) { + if (m->gregs[CCR] != a->gregs[CCR]) { return 0; } From patchwork Sat May 11 11:53:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796234 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236262wra; Sat, 11 May 2024 04:56:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUOw1AP3VdC4YlCbhbls4HOSRBcjbXy2yqzildOHarlxctJzY1NEvLSzYz8EVoqJfSuatV7FOvGCmMDfvt9V9Lz X-Google-Smtp-Source: AGHT+IGQsnw0KtXc2Fs6ouPL7qGpbH+7ECO3o23G+ZPMoWravAKGgGWdelcW8y3Z0H0td2t2fqwu X-Received: by 2002:a0d:ebc7:0:b0:61b:3356:be1e with SMTP id 00721157ae682-622affa6abdmr49592597b3.20.1715428596216; Sat, 11 May 2024 04:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428596; cv=none; d=google.com; s=arc-20160816; b=jwNXxEPvL37NqH8l5kkpRUdV5b7q2BIVovCHBgjNG+52TfaB37O+vS91sWMa7h211N j+T+xWn0eTRcsMJHvs8699FX82Qq1aiI6N3SWlvZf1SKH0UidXkko4+fn6hdOIRos7HM IQlVvttc6Iodh7ldQQEHn3YhzyhSn35iTeXNFPGi6gtVrX3UePvb0J7daD1rS8dHsrpq hFNh1mFHhpRHsrnLpF89LaN3t8HtaDtHUGkPmM0cc7UK9hdcJWXdpDcm4ft90kXcVSq/ PIBIcqmxF6mB1oVwogPve9wlOgoHFiURzA5pHWibkgWsE+lybBaoDmnqG7jhT4Zzf99b yZ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AMtGB7SdOO69qhWqUoEC0VG8+kqB1EisNhBCOHuP3kg=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=icXWqE3KQNhFidmQgeo0btZOVMOzhKMH1fxs9dA17K71HMdpyk/ln8+UQAe0krd7kF pFxgDiWWmxlxr9e/3x+05JZWCH2STE2qq3KahnGA9w6SaSbr+/n+dsFE13Km40y4h3c6 Z4OrU7Gx2x8Hgrjk3mY/hZyvqX4okFWARBDxBh8yA5F0ETsIbvux65ODBvud9Is5COXC gDtIueySSe6WksCJIiKl0fX47kDq4oDnP+ba2Rk6FZaQxVaR4Ky4q6ghD893wpDUeDW0 2Hw9fpbElEkqlVqqXArBW7rqD0O0uvrah35FnrlZsgnwBATVkUKSkY90sMewjxsBAKN0 DxNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUPRLVI6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56eef61si55831031cf.789.2024.05.11.04.56.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUPRLVI6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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, void *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 = 0; i < 32; i++) { - if (m->gregs[i] != a->gregs[i]) { - return 0; - } - } - - if (m->gregs[XER] != a->gregs[XER]) { - return 0; - } - - if (m->gregs[CCR] != a->gregs[CCR]) { - return 0; - } - - for (i = 0; i < 32; i++) { - if (m->fpregs[i] != a->fpregs[i]) { - return 0; - } - } - - for (i = 0; i < 32; i++) { - if (m->vrregs.vrregs[i][0] != a->vrregs.vrregs[i][0] || - m->vrregs.vrregs[i][1] != a->vrregs.vrregs[i][1] || - m->vrregs.vrregs[i][2] != a->vrregs.vrregs[i][2] || - m->vrregs.vrregs[i][3] != a->vrregs.vrregs[i][3]) { - return 0; - } - } - return 1; + return memcmp(m, a, sizeof(*m)) == 0; } /* reginfo_dump: print state to a stream */ From patchwork Sat May 11 11:53:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796235 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236265wra; Sat, 11 May 2024 04:56:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVhpYUzQKMGYDFKl+bWYcYEFpt01FiqJfDGZneTOwu7+tABeylmrqgsO4ZIZ++mITF60849LZtgMsPqNjvU+5kp X-Google-Smtp-Source: AGHT+IHxhdk8RUizTrdp73CDkRMjfTUKDGjLlmaSBb0OvJ2qtDO0Lh7lL+R+MVknv/kbOSORQzmV X-Received: by 2002:a05:622a:559a:b0:43a:f007:a476 with SMTP id d75a77b69052e-43dfdb1ee36mr59135171cf.2.1715428597507; Sat, 11 May 2024 04:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428597; cv=none; d=google.com; s=arc-20160816; b=CPaHQfc8UhHmozSBJ4TxPZW+7Aa/Bp1cSEmGIpkJNUD9jYB40HbWfzik67SYdloONo 8MF5bCb8IUlLuY65ZkvsjQ367H4zM9zf1anA0+RdKxvQStSG1BVGmNuROYwM1KUgZ2PF bOMG5BpQFgb5HyFNDE6m+Q8C50cF7DUEPtwIM0LlRxfcPBsPNGp9eceEuHERjGe33oSQ WgfxOQbzDJFGEO/OlvCZA9ZwLNVyKus9HvOzJoh8oKAqY8U/JBRBU9Eoo4zrR1a32qzU XGNXiylbyHJVqNHdJrdn3MOpzIFMKKTIjxnSXKSUFkeyCppsi1HnvnnLXAkSMEXRrUM7 1DzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M2krjFClQtt6ewuvoLiaCYVCPhv1mkrudW+d9ZYqpvE=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=QUUDtoYGTRUg2hGB4dyfvqdwbFwmINySc0YH5rj/G5FkQ84hUOsdiP9uzauxPZGgRU Rd/4J/7dWoYvwuvVeI7EERAUazYu5FVvH0EGXhbLmqQCNWMZUGFpbVa86tStqM/OquUS Hwvcm8O2jNCIRBkg0y7jAunQFBz2F/IZnyFQcJGqO2uXLpAfKgdx97oml3lpc+uaZnZ5 bxm6vu8wwG7LyK57KLdCLLNzA43I7ROW0xb6BOhA+ubohUlWwya0HOH1WRmglVUcXmEf XSOn4zDw6ysSBfzRpcG3IF8C3EZEXXkU/F/6DqUdQvTbLtXj9vbaT4uvcarPGUO1lWJm 7/0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OuDha/Hb"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56a99f2si54731111cf.497.2024.05.11.04.56.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OuDha/Hb"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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; - 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 = 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 = 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); for (i = 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 = 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 = 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]); } From patchwork Sat May 11 11:53:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796239 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236604wra; Sat, 11 May 2024 04:57:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWLJwQ73WRIOPm98ysp4OFuhc2sWx+IxsjvPvg3F0xHuPIee1b8z38be/neGA6GEE/ouY33hTlzf1fedmgndfT4 X-Google-Smtp-Source: AGHT+IEV9DWKY6p22XoKt9OzUzpTyBNZI5jhM1Lsp4lM2hT1QzWG6sOB6Z4VfBFUeFjB8Q67MQWU X-Received: by 2002:a05:620a:7e6:b0:792:c854:42fc with SMTP id af79cd13be357-792c8544312mr460943785a.69.1715428678676; Sat, 11 May 2024 04:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428678; cv=none; d=google.com; s=arc-20160816; b=R/UK7nkh/mzU9pYEW/4ZItZcZ3NJ2m9NreC7KPRBW4k4Y94vyHSveNwYGR6sQlczBo VBRn/ACdLVNaD2tjAIxmXeicvbs6z3wLCsSd6pLEJrUkqngtWPEQL07uQmnlE6RS1EIi OK+xznylZgLMIyDUZwPmA9UZurEMd2izhelE/DbX47TNyogOXmydBpp0IioAkdWsdpQJ eM3BdNiKXEDbLhwN179DvKI04+wBlEcvxpb/WmuojBKCmrWaclHgjoy09CXAI9yy1CiW SaQ2Bccf572ElfL87KDB8mBusVLCy+F6GTnxBWOJf/ODCNCBwdFghOgh6ofwIv2cuW4X su8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cCWM57OHz2JIAYU8qBsg/sKiTEv/cPu3ovotF6RL+Z8=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=DJIv8yZ869QjQwIT9YeY9qfPm/VTLIqJhSCTwfmSBw8JW3VPYBOd6hAuHCCwHZ9TPy QXWmajxVOQvWiHl+zpodeh4z5+pLdmvSaWoDgTwHZfRqiMKd+3rbl3okUynSm9jI50Oq ya6eaz/c0IGsTuNM7cDAejn8qEj7AJx9o2Nm8nankitr6OVbx6QCGdRsOjFBAwoMRmvb TMRIYJMAw6/bJFhtI+zA2Cu2B+7/mOu+QVa99PqY7Q22uJAlEcrObfGIagzcVIay8gPu Ju7Q+pW3SZqXFmOazjVOrGSmCYPfGnSdhdZYJAVPcaN14aeL85XaF17iUfEbsRDi+MnZ Xw5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kfWURy32; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf30b677si549936385a.379.2024.05.11.04.57.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kfWURy32; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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, const void *p2) return memcmp(p1, p2, vq * 2) == 0; } +static void sve_dump_zreg(FILE *f, int vq, const uint64_t *z) +{ + const char *pad = ""; + int q; + + for (q = 0; q < vq; q++) { + fprintf(f, "%s[%-2d] %016" PRIx64 "%016" PRIx64 "\n", + pad, q, z[2 * q + 1], z[2 * q]); + pad = " "; /* 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 = zb[2 * q], zb1 = zb[2 * q + 1]; if (za0 != zb0 || za1 != 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 = " "; + pad = " "; /* 11 spaces */ } } } @@ -237,19 +249,14 @@ void reginfo_dump(struct reginfo *ri, FILE * f) if (ri->sve_vl) { int vq = sve_vq_from_vl(ri->sve_vl); - int q; fprintf(f, " vl : %d\n", ri->sve_vl); for (i = 0; i < SVE_NUM_ZREGS; i++) { uint64_t *z = reginfo_zreg(ri, vq, i); - fprintf(f, " Z%-2d q%-2d: %016" PRIx64 "%016" PRIx64 "\n", - i, 0, z[1], z[0]); - for (q = 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); } for (i = 0; i < SVE_NUM_PREGS + 1; i++) { @@ -312,7 +319,7 @@ void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) } if (m->sve_vl != 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); } if (m->sve_vl) { @@ -323,7 +330,7 @@ void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) uint64_t *za = reginfo_zreg(a, vq, i); 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); } } From patchwork Sat May 11 11:53:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796227 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236104wra; Sat, 11 May 2024 04:55:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUoYjrn4fGrh325IIfVSwijlZ9ZZhDKdyG0/p+X8m81uQx38U38GpFUtLwtn7+6GZb79Uls0A5JYxhrIpU3/hkB X-Google-Smtp-Source: AGHT+IF4hxlm/lDZhoFGnrBe7odsiRwg1bT94lWgQwl12+dk1HOLD5ZHldOrYDVp6T1d2cosKVYl X-Received: by 2002:a05:622a:1e0d:b0:43a:bee9:eb0 with SMTP id d75a77b69052e-43dfdb527c6mr54583561cf.35.1715428556759; Sat, 11 May 2024 04:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428556; cv=none; d=google.com; s=arc-20160816; b=vvQm7LyWf2OTY7F+sRWkTofoUXRga+I5oVIYoSntAzJTeRNVxzGLWHLQPexzxrSagS Jo/N8zhQGEoTrjlhGIb//MpStgPgoejqeUR1ufqWSjZ4gOglNbvfuqhRl1+j3GB/JOuq 3918kCk7rkNhbllRH645yoJew5E/F1rFkBokckQXDnGHb/VUkW6iRI4uBr7yoZBgMXNa 3XDYqaqebIz/pYKT3jXkIA0Kwd6J0Q13LiUens4hBQgDDlgjmV+jMa7CRGfU+ptvbfER hoF8+4g9vokGcq/syTHsvMWFggXF/cSMmaJbURYQZ2beJ3w/NCNN4lQXBIH+VE8Tgs8h HmAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CUAtQ4JWX99wQQNvfX1Znsvuc3Jvk42mU9SVFi0MMTs=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=NpJxFCebIl7En649Q7Z/JtBB9g4ldTlkIXodaVnf0cYaDORVcYVw9KXikBc6d2S3F/ qS4eq+z4OeWuCCCb10BaPBRiqoINIS7qWXQXtDde7kt/d5+JxZtCVJs35PM704u6JnHF izTbqHpfB1dDe2I4AbnwXA2VUW44tToQPoJIx17BCj+2tV4hH8E2Vvhq5+IB2WhhwTyX nE/5/p14B6T/H8jUg3giCQPaL6emh41t7slbZVF22ZtDJ3sIBkNQa40yfVhLJMXPS9Ff 6J/YCSdLcDaPm1lf3qWi7blZK2chNUd0SmHg0sakGRtcNe0++kcyrXo1NOImzFj3Gra6 MUaQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j17oNVJ2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56e3e7fsi55720961cf.756.2024.05.11.04.55.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j17oNVJ2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Require NVL == 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 #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) @@ -36,12 +73,16 @@ struct reginfo { uint32_t fpsr; uint32_t fpcr; uint16_t sve_vl; - uint16_t reserved; + uint16_t svcr; - 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))); }; +#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]; } +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" +#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[] = { {"test-sve", required_argument, NULL, FIRST_ARCH_OPT }, + {"test-za", required_argument, NULL, FIRST_ARCH_OPT + 1 }, {0, 0, 0, 0} }; const struct option * const arch_long_opts = &extra_opts[0]; const char * const arch_extra_help - = " --test-sve= Compare SVE registers with VQ\n"; + = " --test-sve= Compare SVE registers with VQ\n" + " --test-za= Compare ZA storage with VQ\n"; void process_arch_opt(int opt, const char *arg) { - assert(opt == FIRST_ARCH_OPT); - test_sve = strtol(arg, 0, 10); - - if (test_sve <= 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 = strtol(arg, 0, 10); + if (test_sve <= 0 || test_sve > SVE_VQ_MAX) { + fprintf(stderr, "Invalid value for SVE VQ (1-%d)\n", SVE_VQ_MAX); + exit(EXIT_FAILURE); + } + break; + case FIRST_ARCH_OPT + 1: + test_za = strtol(arg, 0, 10); + if (test_za <= 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(); } } @@ -51,6 +70,31 @@ void arch_init(void) { long want, got; + if (test_za) { + /* + * For now, reginfo requires NVL == SVL. + * There doesn't seem to be much advantage to differing. + */ + if (test_sve && test_sve != test_za) { + fprintf(stderr, "Mismatched values for SVE and ZA VQ\n"); + exit(EXIT_FAILURE); + } + + want = sve_vl_from_vq(test_za); + got = prctl(PR_SME_SET_VL, want); + if (want != got) { + if (got >= 0) { + fprintf(stderr, "Unsupported VQ for ZA (%d != %d)\n", + test_za, (int)sve_vq_from_vl(got)); + } else if (errno == EINVAL) { + fprintf(stderr, "System does not support SME\n"); + } else { + perror("prctl PR_SME_SET_VL"); + } + exit(EXIT_FAILURE); + } + } + if (test_sve) { want = sve_vl_from_vq(test_sve); got = prctl(PR_SVE_SET_VL, want); @@ -75,6 +119,9 @@ int reginfo_size(struct reginfo *ri) if (ri->sve_vl) { int vq = sve_vq_from_vl(ri->sve_vl); size += RISU_SVE_REGS_SIZE(vq); + if (ri->svcr & SVCR_ZA) { + size += ZA_SIG_REGS_SIZE(vq); + } } else { size += 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 = NULL; struct fpsimd_context *fp = NULL; - struct sve_context *sve = NULL; + risu_sve_context *sve = NULL; + risu_za_context *za = NULL; /* 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, void *siaddr) case SVE_MAGIC: sve = (void *)ctx; break; + case ZA_MAGIC: + za = (void *)ctx; + break; case EXTRA_MAGIC: extra = (void *)((struct extra_context *)(ctx))->datap; break; @@ -134,21 +185,55 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr) ri->fpsr = fp->fpsr; ri->fpcr = fp->fpcr; - if (test_sve) { - int vq = test_sve; + /* + * Note that arch_init required NVL==SVL, so test_sve and test_za + * are equal when non-zero. We will verify this matches below. + */ + vq = test_sve | test_za; + ri->sve_vl = sve_vl_from_vq(vq); - if (sve == NULL) { - fprintf(stderr, "risu_reginfo_aarch64: failed to get SVE state\n"); + if (test_za) { + if (za == 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 >= ZA_SIG_CONTEXT_SIZE(0)); - if (sve->vl != sve_vl_from_vq(vq)) { + if (za->vl != ri->sve_vl) { fprintf(stderr, "risu_reginfo_aarch64: " - "unexpected SVE state: %d != %d\n", - sve->vl, sve_vl_from_vq(vq)); + "unexpected ZA VQ: %d != %d\n", + za->vl, ri->sve_vl); + return; + } + if (za->head.size == 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 |= 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 == NULL) { + /* SVE_MAGIC is supposed to be present, even if empty. */ + fprintf(stderr, "risu_reginfo_aarch64: missing SVE state\n"); return; } + if (sve->vl != ri->sve_vl) { + fprintf(stderr, "risu_reginfo_aarch64: " + "unexpected SVE VQ: %d != %d\n", + sve->vl, ri->sve_vl); + return; + } + + ri->svcr |= sve->flags & SVE_SIG_FLAG_SM; if (sve->head.size <= 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, void *siaddr) "failed to get complete SVE state\n"); return; } else { - ri->sve_vl = 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) } } - memcpy(reginfo_vreg(ri, 0), fp->vregs, RISU_SIMD_REGS_SIZE); + /* + * Be prepared for ZA state present but SVE state absent (VQ != 0). + * In which case, copy AdvSIMD vregs into the low portion of zregs; + * pregs remain all zero. + */ + if (vq == 0) { + memcpy(reginfo_vreg(ri, 0), fp->vregs, RISU_SIMD_REGS_SIZE); + } else { + for (i = 0; i < 32; ++i) { + memcpy(reginfo_zreg(ri, vq, i), &fp->vregs[i], 16); + } + } } /* 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); if (ri->sve_vl) { - int vq = sve_vq_from_vl(ri->sve_vl); + int vl = ri->sve_vl; + int vq = sve_vq_from_vl(vl); - fprintf(f, " vl : %d\n", ri->sve_vl); + fprintf(f, " vl : %d\n", vl); + fprintf(f, " svcr : %d\n", ri->svcr); for (i = 0; i < SVE_NUM_ZREGS; i++) { uint64_t *z = 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 = 0; i < vl; ++i) { + uint64_t *z = reginfo_zav(ri, vq, i); + fprintf(f, " ZA[%-3d]: ", i); + sve_dump_zreg(f, vq, z); + } + } return; } @@ -322,6 +427,10 @@ void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); } + if (m->svcr != a->svcr) { + fprintf(f, " svcr : %d vs %d\n", m->svcr, a->svcr); + } + if (m->sve_vl) { int vq = sve_vq_from_vl(m->sve_vl); @@ -347,6 +456,18 @@ void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE * f) sve_dump_preg_diff(f, vq, pm, pa); } } + + if (m->svcr & a->svcr & SVCR_ZA) { + for (i = 0; i < vq * 16; i++) { + uint64_t *zm = reginfo_zav(m, vq, i); + uint64_t *za = 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; } From patchwork Sat May 11 11:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796236 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236288wra; Sat, 11 May 2024 04:56:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVRBCIQye0/URqiSkkkvzhCFQf5oWro/KyqqO5u1mCYp9tHrKIWLBy4cpAjeerKwm8cBCDLvEJ07Qc++WNkmLMP X-Google-Smtp-Source: AGHT+IFgaAqElhG5QooV424IKicYVeIBY4kwotrcxWOqUSfFeX4CID5ZVVcP2BqxIpX9TseqlL4c X-Received: by 2002:a05:622a:14b:b0:43d:f712:d5bd with SMTP id d75a77b69052e-43dfdb90ef5mr52946171cf.47.1715428603249; Sat, 11 May 2024 04:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428603; cv=none; d=google.com; s=arc-20160816; b=YYVGizJ+5SPFiD290p9zwq/8ZcB05lq5yPpodVGi64gwpKDagMZcVBOmaYJAIbAKro SxiXcy0UaSTL2IhXf2R3JnO4JNSF23ayioIInK6XAjlChr8/qO4MD1cnW37mNj4ZMkYJ bFSmYriZk47nYzM+y0yPQLCnc1ie54olQfAg+xXfkFiQIDPhCJldyfHg/kb3SIal+Nrb /K4DYFhfHfP2h81v6x4BTOwCQ/jdfYlVmIcaYSyrHGtl4ty82rmsEwbviWaYJHQ/hrit HbVr/xva4dt3lYYIXY6cFHSLXj8N8C9Rb3f40xslPROKEFNCVCwFJMHQK3QjtKac11Cb LujA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TszikIIR0P364Y+SfqYmtCRzUOVzTKFI40YQ9lx2ZZQ=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=JwZyB0QjQNPF4bm2MBE6K0EajBJNFuH8q6xNgUYWAsPLmEBB9oCip2PaO+6lzmYV8t gPUhJBHX30XcL1diBbSmcFJZGwoRZDJrlIHPZMtfha+sBHci45cqBpnvvEqoY6YIKX41 UpwiBaKWqTZlZ5kfJ1eRfOiaPLg2u06ojNr8tudo07jW16R1AQHqneOGceo3SCWS5JIc iSq2bj7cpP0kpxzGGKUgG1XHecvpqNbaRHpATdbeYRsEX+PFgoSSEXw8kJACcb5Vu/Xc lulLOBRNeJfaU/0QEvJxgP8kNRkFeivWPyB7Hhtcnph0S7qZgW0p1mKPL72++HLWG0FL FT2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DRPzxLOm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df54c31besi39670321cf.227.2024.05.11.04.56.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DRPzxLOm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 */ From patchwork Sat May 11 11:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796226 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236005wra; Sat, 11 May 2024 04:55:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUo3hxzmlBoIRHhIZogyWCqQx3muskRFfgEwxwfzDDM65giudccSzeqVAtgEX3Izd0IioRtzY1EW8TtxCjD5ChC X-Google-Smtp-Source: AGHT+IGyns6OErZMkOgSq3FXgasPEiyzUWTGYmrjW+3pR/hPeY2c3FDFzDjQV/QJ9qO2jzlRqN50 X-Received: by 2002:a05:620a:408b:b0:792:bbbe:57bd with SMTP id af79cd13be357-792c76101cbmr682541785a.73.1715428532818; Sat, 11 May 2024 04:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428532; cv=none; d=google.com; s=arc-20160816; b=C8pAtulLw/rQLkiWDAZs7hojB7njowQWhq2mVA1IPhqf8u1Ggpsrbi1+gIbfJJXLz2 d+R321cDKJXRoISYe/IqrQ4rC/0exICz9qcvO8v1Mj9mhVzFlZL8HVWlDJpAbAa+Huub ymtNIjzegBkrWgXy5OvxQbPXABEw323V+WunnaTojDh265wdxYLtBA0ZV9ln+NyfQmDf Lx6Vz3uw2p5JSUzlqeu54YIjjRBRoB3uvYjhKrttYAXypIcywiETPtIIUjeC7AYlSzFf Yf9TGBePatmnjrnnJLQjgN3+ZeVcuw/Y1wfWo3F3u2vmebHZloQaUk+JyrBiDPu+x/ui CUew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Hfxi5Tt4Z237MIY1mS3UWYWqzflEOIMry0lrn96HNUo=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=KvKLaDn6QVlNL56aIfa8+Xc7OSEnc75SmYeScDhK6LLpOIg7ukhrqMuvAtgSGjBfk0 EEI6LUG9sXinaDGHOrfiNECETKRWLs7xtde9oEv/zNGA8H2fLfaPZ0/iYLSiARGDlkYc oan0dLAe5ekJXqeAAzXOvwS+ouJVrgRDrAMMRxYbkn0uiqUjriLMGicd37NZFGU07vJN uJdB1/kIQ6Lf+l/r/Cd8UFHx4ZYzsFqW0XUGApLIguYAEow7nm9BWPn4tbeZ92lLqeVO fLI164Kx5lF3C468ZQFna86oeOw2dHNjpNFt4RaWUBN8FPAWyJCcIzCRVuZIeYHZ5kml T1Ow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EkQN/fjF"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf30ac35si549538385a.269.2024.05.11.04.55.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:55:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EkQN/fjF"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The function result is more naturally boolean. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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); -/* 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); /* 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, void *siaddr) } } -/* 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)) == 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, void *siaddr) reginfo_init_vfp(ri, uc); } -/* 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)) == 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, void *siaddr) #endif } -/* 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 *context, void *siaddr) } } -/* 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, void *siaddr) } } -/* 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; if (m->gregs[R_PS] != a->gregs[R_PS]) { - return 0; + return false; } for (i = 0; i < 16; i++) { @@ -69,27 +69,27 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) continue; } if (m->gregs[i] != a->gregs[i]) { - return 0; + return false; } } if (m->fpregs.f_pcr != a->fpregs.f_pcr) { - return 0; + return false; } if (m->fpregs.f_psr != a->fpregs.f_psr) { - return 0; + return false; } for (i = 0; i < 8; i++) { if (m->fpregs.f_fpregs[i][0] != a->fpregs.f_fpregs[i][0] || m->fpregs.f_fpregs[i][1] != a->fpregs.f_fpregs[i][1] || m->fpregs.f_fpregs[i][2] != a->fpregs.f_fpregs[i][2]) { - return 0; + return false; } } - return 1; + return true; } /* 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, void *siaddr) ri->vrregs.vrsave = uc->uc_mcontext.v_regs->vrsave; } -/* 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)) == 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, void *siaddr) memcpy(ri->fprs, &uc->uc_mcontext.fpregs.fprs, sizeof(ri->fprs)); } -/* 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 == a->pc_offset && m->fpc == a->fpc && From patchwork Sat May 11 11:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796224 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1235900wra; Sat, 11 May 2024 04:55:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX2lvUJjQcmyIhrAOhj64hKRu4wyJrZLqEPV2p0rGzQ5qbMmWoWpfqRb/VWuax0OqGChJVWHae1kxM6Yfk4FnO2 X-Google-Smtp-Source: AGHT+IGIsUrM0VDuufV4SAvXW4Ma2lMTQJ0kdAH0HtipsqhfA5dISd71cKkDbiL+LOrADQJfketf X-Received: by 2002:a05:6214:4605:b0:6a0:48c3:52ac with SMTP id 6a1803df08f44-6a16823cc3fmr60545386d6.45.1715428511362; Sat, 11 May 2024 04:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428511; cv=none; d=google.com; s=arc-20160816; b=hkcq+/oalZLLvYERRdyK8u/ayFE3sbJzUjfzDPnSSEd9vDnxni9DIguOQpko/UpkDU BV76L8M+D6SlfxZ8eJOMSmqbaLq+pTKYVSwo0+ALDcaV9xuretjHDQw1lDIGYLcwP3TL kGeqRUSVeDL3WCu4l4pdeQ5hE4pcgig1Hf4Fsq5wTfFYC6sPdrzUeK0z6f/VNzr3qq2I cU75YC16WRht7elmgQvS2xhNnFhLucDOUB0S6MYeJulfV622NP9PS0SX7WWw8et+nBd8 uwjgnitO0LOTbAZinDv7HC5LsB2f1ht6o9p280VlOULAMMkeHT2uRPTJU7tCA1pB/w1T 0DNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G/dRk75Xa2dli8e7P8dUDOHpTSk+dp2zsSzv4pGi5N4=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=RjHZx0gYG0SKCmimLV5QP9uvN4SJ025hH+ZZdrvD+HuakK0tc4PbpCeHvGydebGzsB sT1WWiFfrDtHBc99/c6IbpjBCdBSg9h9f7cm4MTDnHoLXEOObqDOOSWvCgSWdcCRGQJM q2Nv+OTtODvk24sbVBQUtOcaJmFdeMcqOMm6Nb5caS5dWuIF5pCbX1lRHOUYtG8NLIUR VhmwtNoPi7N4gvNphO/yrx7/cNh7xR/0eqmudtgbBu/tWV7xlYyWWMPNv1CK4YSNZQug YKTsLOjJ3hI8KtiNMYsrUObc3rdCSjTdQqEHNVJWjYdYPpf2HGyrT0ipsEQfXweMbN7U a4vQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QD47BkWW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2f5fbcsi56870006d6.524.2024.05.11.04.55.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:55:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QD47BkWW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The functions results are more naturally boolean. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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)) == 0; } -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) == 0; } -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) == 0; } From patchwork Sat May 11 11:53:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796232 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236189wra; Sat, 11 May 2024 04:56:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+Yk8c7zzboaa188vmuzXCQ3OVAWVJFnTJPRcPQkXn03DrCiRZyZbJ3EPljfYSzn/Jvxu+zkxExNlf+/r1yxVp X-Google-Smtp-Source: AGHT+IEc8zCbRgWb4kzLbPL7S9eXInMVCHxB+g50uFhmVZi9M2e1dxsA51OK1PBpNiwGrOGzccJy X-Received: by 2002:a05:620a:3b8b:b0:792:9a4a:1c3e with SMTP id af79cd13be357-792c75aefc3mr548130385a.42.1715428577428; Sat, 11 May 2024 04:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428577; cv=none; d=google.com; s=arc-20160816; b=WkdZI+Y7cSEdDi44esuiGm2e3yCVWiCPF3P725efyLnvNprZV04LawetcCG2NKSxIt Jc9pBSUnb7rhrjJNWUucbexsozkixf39DgtfU063gQmF+kDYq/qp1UBL5NANhUuWkYKb 1yWqE4ilSZkYNqnwS/d1wYRMDxpv7pc1AGt9FQ739dBm7fo89lGaZJFCDxaUEGLDrYnM G/TfKLcFRxfoKaJ0mfgqDh3194NMlC7fx4zussCVKCiKgPyCNzYxojd1yrLiHH1FQ0aH Smx6uWdVLo+jkzDvgkzmP4fhkLOLrMew4/9cTwvL18wSI4TMsEnX1jZDgu6d6Ot0H1Vm 6Icw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HpcdEdoUPPV0pGSNw4XA78udWGrbKRqXBRNX1k+qgFI=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=aJGQQlPrKZouNg2dTTQXotZfdZQSl38vggXik9tS25cBkcTkaYXbRqJEiChMZPCQST nF2ssBygFyQEXjIXhC44bplagW5xvgSNvVgZBqZHTrt/UtwuuKjcD5rz4nyihPbHSbBy 0CMKRRkttNEvumjvAgntuL+a2hg338oVB9nY8o9C2OgENud92OdotdYLY8prpBseGNUQ Ku0IAKrAzwboAdNF0X2kZDCJBOAd3QtH1OsJiUi61Cpiv+OfWyFwyGP6VEbUQq6bkeBp 3kcNVGrkoGXuJMlQpQkrYfjcC2AApnpnu+eHMe26n40ucLBhGMVhRiKJW1fcVEN1cMJ7 WGSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GCqB3v4/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf360a50si549216585a.609.2024.05.11.04.56.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:56:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GCqB3v4/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 #include "config.h" #include "risu.h" @@ -371,6 +373,57 @@ static void load_image(const char *imgfile) close(fd); image_start = addr; image_start_address = (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) == 0) { + const unsigned char *e_ident = addr; + bool swap, is_64; + + switch (e_ident[EI_DATA]) { + case ELFDATA2LSB: + swap = __BYTE_ORDER != __LITTLE_ENDIAN; + break; + case ELFDATA2MSB: + swap = __BYTE_ORDER == __LITTLE_ENDIAN; + break; + default: + fprintf(stderr, "%s: Bad elf header: EI_DATA = %x\n", + imgfile, e_ident[EI_DATA]); + exit(1); + } + switch (e_ident[EI_CLASS]) { + case ELFCLASS32: + is_64 = false; + break; + case ELFCLASS64: + is_64 = true; + break; + default: + fprintf(stderr, "%s: Bad elf header: EI_CLASS = %x\n", + imgfile, e_ident[EI_CLASS]); + exit(1); + } + + if (is_64) { + const Elf64_Ehdr *h64 = addr; + Elf64_Addr e64 = h64->e_entry; + if (swap) { + e64 = __builtin_bswap64(e64); + } + image_start = addr + e64; + } else { + const Elf32_Ehdr *h32 = addr; + Elf32_Addr e32 = h32->e_entry; + if (swap) { + e32 = __builtin_bswap32(e32); + } + image_start = addr + e32; + } + } } static int master(void) From patchwork Sat May 11 11:53:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796238 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236550wra; Sat, 11 May 2024 04:57:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYiguh0gCancN9k4IRHfsmkZJOHe0hkHWHcD7CySc7L+9geFKhvpPGmE/LWTIDdVDA5MEZhpgfRj3O4X/ZARAV X-Google-Smtp-Source: AGHT+IF7eLhGIXt5zUQMP6JytZni7c1JPKmRri7p6+Z8QzuLqHrCJAhZV75H9T9pbsnvaCqI1hbf X-Received: by 2002:a05:620a:c4e:b0:792:d2aa:5e6 with SMTP id af79cd13be357-792d2aa0723mr85845285a.35.1715428668355; Sat, 11 May 2024 04:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428668; cv=none; d=google.com; s=arc-20160816; b=TWuB8wFtqDK/IyFcWEh1ES7ahBRadxoGTZMWWz5Q+TtwHT5vuxrQQNIdH5+g4dEYqj JcyMBi62EDixiAp/34dbZcZUPyeiPh4GvJMGIy0zNPLW9VatyfGRcyDHPY5T6+XwifIH hOwBdr2tOEnzgQJ+Vs6m8aKWkC1nGv/KvNvBMRIwlaW7hMyHAhZPCUqzkMS8s8XegL6D x2zNkiXLauLHQKLKq7LoblX3WQ1j5oMsstnQpTFxJ1NZq2kOwypLMqrOPVbJeXXpcPIc /21GcA3SFMLt3HqrTP/36mjoI3YVtVMhrXOu0ZdKGMe6hOHqRooeCmonhH+U304dCL0y yMxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LlF/qVnfBB0/mvdhSrl0HFniC4poDP63wiS0TvU6Y90=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=B740v6yRfYyZwwHXY0D6bJhyp4P69+u2kQtMd0jxHIHcCNPk0xHRH5ChhIwWpbLhBT XTcj/thODFBUi37PIeU/dRb5xdBcavImD/7StPYScKIv0SYSFtcMkzscZ0pRJg8/Jqzd zoj7KyYarFVTy8GwPrMHriZMAl22QBbI9HucBBrD2D40GgeP7gDOETdzyfqEEhf6Vs/+ ViWH8KqiLeg+XWSAJa/zdaaQ1UMnBCjKito5Bb1NZiI0AnTnH8CL+JyNJjdXlkaS7xrY gDxDwQ3eeI68Y+rFbSj5OAeZMSUJL4wiqdq7HhcP75iYfAJb3PCCz9OVxEHJFXnLvt5J 6HMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fic8w32T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf38ec16si538483185a.731.2024.05.11.04.57.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:57:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fic8w32T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé --- 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="arm" elif check_define __i386__ || check_define __x86_64__ ; then ARCH="i386" + elif check_define __loongarch__ ; then + ARCH="loongarch64" elif check_define __m68k__ ; then ARCH="m68k" elif check_define __powerpc64__ ; then @@ -141,7 +143,7 @@ Some influential environment variables: prefixed with the given string. ARCH force target architecture instead of trying to detect it. - Valid values=[arm|aarch64|m68k|ppc64|ppc64le|s390x] + Valid values=[arm|aarch64|loongarch64|m68k|ppc64|ppc64le|s390x] CC C compiler command CFLAGS C compiler flags From patchwork Sat May 11 11:54:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796228 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1236112wra; Sat, 11 May 2024 04:55:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXSRxkhiFh7BOoJt214WqoPrxVF5aAUooClVyffyWMOKu8F1v5dpgH+1kpKp0iReAa64RLr0PY8SvfoPfZoThHN X-Google-Smtp-Source: AGHT+IEmp9fNTJMn08obwTz2i2n1kt7obU5S1yF6NkcL2a9IAKozwHMrtgz9+bF2KjMlP81SeadJ X-Received: by 2002:a05:6214:3389:b0:6a0:af99:6b4 with SMTP id 6a1803df08f44-6a16825685fmr56037956d6.57.1715428559447; Sat, 11 May 2024 04:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715428559; cv=none; d=google.com; s=arc-20160816; b=u9ecnfpjo+sLjB9fDoCPz57CBuKgqyFrYMrm7HGixVem+1tHtZ/Ws5HAaw//YnZUon 5ndD2qpxdGku6nCwrIxyNRXBN/VXgsJALTqLB5YKB4VhZj+HmlDyXgnrTyeCc48Vbsdp lvdSZwOeW24QQSCeiBgt9IvZ/oOyFg2yzoJYi79tJ2VeZ9BlmCsqXmMW09Q62HYlmfjC 52Z/yNqQWSVp0ruTVyBgFd6MDTiVOdXAVRcTjue6ytq3WQY2l8bcahZ+WdeU10NsDsNu uu8QGA1NszTvTSAiqcLjCA/uqVtBx0ZeFMtv6xAlhLeNFg+3tTvRD3XCF9lNsOuDkf8P cBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gCHqJdB9ixZnMzJUa7fmPKgSiCmh3gi3e9Ib/ZnK7PQ=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=eBnQ7Ay6cU2Ko1JWhJUpqUSju7PstUpbaFgWNBc7WToM1WZ2PvIGjaBxhkMWCQ813q 5Ylnkxbx9TSNqT/RzMYXT7/y4RirslU+zvLTwO7jY7qCLb3qqUbLpATi/t6i9c6XYZ23 X25RsD/pVZ+qpBLhEuGhv1ziSETZKkK9SfOHidId/ki7+gPAt2ge97Ai/I54L8B4xcDC DvZ3kbFvdk+3Vt6HGNw/34HKDmeXHmDucZSamdSNMWmbcbMZFLLsiVclbzoKQCNyGjnG vi6M7KCjFa3D0AlaYJ1YgbWyaIEGce+/mCVtF0PcCGm7Vnraq8Wxq/idPB5uPfLurBtR BGYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gk3hBFc1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29a280si58261636d6.272.2024.05.11.04.55.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2024 04:55:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gk3hBFc1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 = -Wall -D_GNU_SOURCE -DARCH=$(ARCH) -U$(ARCH) $(BUILD_INC) $(CFLAGS) PROG=risu SRCS=risu.c comms.c risu_$(ARCH).c risu_reginfo_$(ARCH).c HDRS=risu.h risu_reginfo_$(ARCH).h -BINS=test_$(ARCH).bin +BINO=test_$(ARCH).o +BINE=test_$(ARCH).elf # For dumping test patterns RISU_BINS=$(wildcard *.risu.bin) @@ -30,7 +31,7 @@ RISU_ASMS=$(patsubst %.bin,%.asm,$(RISU_BINS)) OBJS=$(SRCS:.c=.o) -all: $(PROG) $(BINS) +all: $(PROG) $(BINE) dump: $(RISU_ASMS) @@ -43,17 +44,17 @@ $(PROG): $(OBJS) %.o: %.c $(HDRS) $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $< -%_$(ARCH).bin: %_$(ARCH).elf - $(OBJCOPY) -O binary $< $@ +%_$(ARCH).o: %_$(ARCH).s + $(CC) -o $@ -c $< -%_$(ARCH).elf: %_$(ARCH).s - $(AS) -o $@ $< - -%_$(ARCH).elf: %_$(ARCH).S +%_$(ARCH).o: %_$(ARCH).S $(CC) $(CPPFLAGS) -o $@ -c $< +%_$(ARCH).elf: test.ld %_$(ARCH).o + $(LD) -o $@ -T $^ + clean: - rm -f $(PROG) $(OBJS) $(BINS) + rm -f $(PROG) $(OBJS) $(BINO) $(BINE) 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 { + . = SIZEOF_HEADERS; + PROVIDE(start = .); + .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) == 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 *******************************************************************************/ +.text + /* magic instruction to force ARM mode whether we were in ARM or Thumb before */ -.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 @@ /* Initialise the registers to avoid spurious mismatches */ +.text #ifdef __x86_64__ #define BASE %rax lea 2f(%rip), BASE @@ -71,7 +72,8 @@ /* exit test */ ud1 %ecx, %eax - .p2align 16 +.data + .balign 16 2: .set i, 0 .rept 256