From nobody Mon Apr 6 19:15:31 2026 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715428574; cv=none; d=zohomail.com; s=zohoarc; b=PzWXIGG5V7mkE+qPX0hLIbaNyek/eUiwaBBXTABEG18a7O8zRPDORiU4SJ9FkWdMXeLq/R1BeWYYSZL5Q79ibkG2K05hZB7uR6bg5k/49mmx79hZsdjG+EoUIV4iu33MBfxz+zPcDsx6Wl0Ych7uB87yWvDfbB5JhwLbzIeBHMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715428574; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; b=QkEsLI/5D82rekgxnQTgkw0/C9rJk3/4n0d+eWwdu1c2KIPaKzfw4yCFOpdwzVeEjZ6ZQYLsajjmmWpxA6ZE1IgXrEkW1csrcSyLoZpURNojXMqAFYtHv/rwJAyuh65lVNmFbK4PkAGAabRecK4zOoSlrSpnhKkPXxiCbTwFz/w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715428574865887.595948027809; Sat, 11 May 2024 04:56:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5lIr-0000JJ-E4; Sat, 11 May 2024 07:54:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5lIp-0000IO-Sx for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:11 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5lIo-0006xn-1L for qemu-devel@nongnu.org; Sat, 11 May 2024 07:54:11 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-34db6a29998so2132056f8f.0 for ; Sat, 11 May 2024 04:54:09 -0700 (PDT) Received: from stoup.. ([195.76.196.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf20sm6764797f8f.93.2024.05.11.04.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715428448; x=1716033248; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; b=C3i/Sm8L8fgcpfcGbXbup/T+72Vh1BcR7CdYP7UPkDqhSodM3sA2bLfKhgq/bXRS4i Esy3X+PASjmGBkTM6rKo5UTSuUZUdUpcEh8hQ/f9Ht1fS9lwQdx44yW7O4amMayv/cBG 7A2t9ASX/FHO5O7x4RYoOGZMYeyaHfB1AMIbPC0zs9hjzjPHgYLclGNDKE3LHYzbX2VJ lCenVMlNV7Edw3Eb9rFQEnbAmJjosPfV8E66jwSjAGvCBhtJkhZbLrdHZGT8dpq5HsjC To72mLEKqi5TP19kIGwrv/vHtx3EtlzcxQzoXl5FO2U+3waN3QjlqgSuDcEveT7zqcug RFNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715428448; x=1716033248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+n0y7sg4pr7eYBOPDNRNBiPuUSQ+dV4I1QimEXAPgY0=; b=QUekZzpiceJAwlzl6gjeo54vtVjoO2coHTTt7tIBCMmjtuixg0X1gEWagzaqrNXN4M 0nQpjOrgh17mUba3MqkDAdW53N+tFYc9+n45HEHhQJIFT4/FxiFiBhc4a+XN72TDBYlz UvKt4bC8j4dOB9uYn2fFeW2vHlKcR1jXtSzQTEu7+Z24ombZJ+om/uMsptYbBD2hSV8l 3iQXyt2HZ0SD8oyfey5jyGBEPs+STt1K5iNzAULC4wxS3lWd5KCTHSdjD93dk8kAS9Ko e2j1Gj8gAlYrS4fB5KzmTlP6xZlgIAJtEsBEtOBcqBcQeN0g1h+OHtG6gz7aNEwG0M/a 0PJA== X-Gm-Message-State: AOJu0YyXhkfCRCeYZrCrnSxvE30Paloev8vWKC9ik1vjqGplnkvpewAY HbnNDF1ioEgNZfInQ4/RIo4opvh7sAhcb6pmJLTOFzLaMEQP9KLGeMIH8ZlVIXakSjh+GyeSjW2 Rmnw= X-Google-Smtp-Source: AGHT+IGx8YpfbvnPnWHEJERLk/6K4MJFluddbQifr6adM54r+UsZr/q96TL9w3O1eyszFA7uP8tJug== X-Received: by 2002:adf:ec4d:0:b0:343:7b6b:dcc6 with SMTP id ffacd0b85a97d-3504a73bc6amr3813189f8f.30.1715428448496; Sat, 11 May 2024 04:54:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 06/17] ppc64: Clean register values in reginfo_init Date: Sat, 11 May 2024 13:53:49 +0200 Message-Id: <20240511115400.7587-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511115400.7587-1-richard.henderson@linaro.org> References: <20240511115400.7587-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715428575369100001 Content-Type: text/plain; charset="utf-8" Smash the stack and thread pointers to deadbeef, as is common for the other architectures. This allows us to drop these special cases within reginfo_is_eq and reginfo_dump_mismatch. Do not copy the unused special registers that are packed into gregs[]. Most of these are related to system instructions and thus are not manipulable via the user-mode instructions targeted by RISU. LNK and CTR are not initialized by risugen, and since in general we cannot test branches with risugen these can be ignored. This leaves only XER and CCR as the only special registers to be copied. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu_reginfo_ppc64.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index fc69805..67ea3ce 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -44,16 +44,16 @@ int reginfo_size(struct reginfo *ri) /* reginfo_init: initialize with a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr) { - int i; - memset(ri, 0, sizeof(*ri)); =20 ri->faulting_insn =3D *((uint32_t *) uc->uc_mcontext.regs->nip); ri->nip =3D uc->uc_mcontext.regs->nip - image_start_address; =20 - for (i =3D 0; i < NGREG; i++) { - ri->gregs[i] =3D uc->uc_mcontext.gp_regs[i]; - } + memcpy(ri->gregs, uc->uc_mcontext.gp_regs, 32 * sizeof(ri->gregs[0])); + ri->gregs[1] =3D 0xdeadbeefdeadbeef; /* sp */ + ri->gregs[13] =3D 0xdeadbeefdeadbeef; /* tp */ + ri->gregs[XER] =3D uc->uc_mcontext.gp_regs[XER]; + ri->gregs[CCR] =3D uc->uc_mcontext.gp_regs[CCR]; =20 memcpy(ri->fpregs, uc->uc_mcontext.fp_regs, 32 * sizeof(double)); ri->fpscr =3D uc->uc_mcontext.fp_regs[32]; @@ -69,10 +69,6 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) { int i; for (i =3D 0; i < 32; i++) { - if (i =3D=3D 1 || i =3D=3D 13) { - continue; - } - if (m->gregs[i] !=3D a->gregs[i]) { return 0; } @@ -150,9 +146,6 @@ void reginfo_dump_mismatch(struct reginfo *m, struct re= ginfo *a, FILE *f) int i; =20 for (i =3D 0; i < 32; i++) { - if (i =3D=3D 1 || i =3D=3D 13) { - continue; - } if (m->gregs[i] !=3D a->gregs[i]) { fprintf(f, "%*s%d: %016lx vs %016lx\n", 6 - (1 < 10 ? 1 : 2), "r", i, --=20 2.34.1