From nobody Thu Nov 14 17:45:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1708704411; cv=none; d=zohomail.com; s=zohoarc; b=KXGzQK6tbpDCNdiJNsWAIEKeuyMkhxr2e9YK5MFX0s/XD9btl+1uONhyupX29Pxj6rwkUXzhp4YR9HiE3ephKIXHIY2accgUfiEI8XkYx1wCrXuEzZ7cHcjqgvkvz0TempiyxsaN4Wf9YzxNGMHK+r8SKFu1dUt+qtV5rJrCnPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708704411; 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=1ncHIEJMy4cYDbqfVJNjY8yl/TUUZBGM2GIItC5uR+8=; b=IGdtqsASJScUqK8Uulik0/M6EvVts/L4fCBpmQj78Kh/CiO9475alRZa/yKiFAF8tJ722kwnqhwTpmQapqP74PjUHGxEKSsAmJaMXWGrM/YrhrAqR9XaB6IJo/MoP3Kd33uNtCOLQicGn5ePoq7s1fWF15PaQwCOVRk32sWBmlA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708704411122951.1559599002708; Fri, 23 Feb 2024 08:06:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdY26-0007xs-Sj; Fri, 23 Feb 2024 11:04:18 -0500 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 1rdXjv-0006OY-BW; Fri, 23 Feb 2024 10:45:31 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdXjs-0006df-RN; Fri, 23 Feb 2024 10:45:31 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1db6e0996ceso7889225ad.2; Fri, 23 Feb 2024 07:45:23 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id h18-20020a170902f2d200b001d913992d8csm11808208plc.242.2024.02.23.07.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 07:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708703122; x=1709307922; 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=1ncHIEJMy4cYDbqfVJNjY8yl/TUUZBGM2GIItC5uR+8=; b=lryJRjz22gVl5BGU1a6Sg0Qtv8Tdpqsc3lrJEFgJWya2dqCUiw31Sw17sNHT1eJUrO dG1wqLhD5r+UJLYs7PTUmV3vB93ZYuNlRp+S5+/BgRQTqjxLZqT/WXADhnwr/HhLwTUq YNbCGHL3ONMhaNdEsOp2zgZ5fbQDsPUGanVx3/Rvb0+cpBl32hZU5RKb12CclBLwsw6v pgMLidm/55/YhO/yEACni6T0QjcBrweA5DcAnnHnifBBRELDMfR1dSaENZZE5w2YMOmC PGTXizl7glmOeN1PoSxMe+i80uhiXKCK7yk8DK1diIKckig9PGvgRxx2+Z5r2ow4Szco qQqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708703122; x=1709307922; 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=1ncHIEJMy4cYDbqfVJNjY8yl/TUUZBGM2GIItC5uR+8=; b=wxh76cE7tZNvj6JfcsO2l6jEFOCE5TQ8Fp+sxFLJOkdH4ekhpdbCMorNiitW10hkYr nQd2oViqxTYxn1KrqkIPdmyhI/5BbJ/YacX5uJHfDgot5fsOPCcXO1MKdepdAbmksfwP qSKHzNi7Hrx2zQC7Tj5qhiny3Ehzu4xofEVk7Gtm7oEtOjv4Kj9ECFf/athNly/E5m10 wP8WyoEWTp1M/PjB4QYGobBnbG9ncz5TvXRs+b0jV3baQMOl3AjlJ1G6Jq0+yIfWoe/z L1AsT+A7fF6skho753LfZMuFOpT48de8hnuyWLVWgXJx5tY9mU7nupai8GzojQd0H/HT /48g== X-Forwarded-Encrypted: i=1; AJvYcCWWvGYY6MWNvrtuCRKrwIPnwH/Vjw0KikeWh78pOV3e1zBesbG4kHWSsF/rz6t3PfxQYkOIs+Q5Bn3Lbt1pkNWudKX/ X-Gm-Message-State: AOJu0Yxfx8LhS+wsHBK/a6/9ibWhTI6rONvYsFf87KMvDSvpwdszZI6S 5oYCBgugoC0OuYWHqHU6XTTuM3vJ646bv7AoE8oHGyYbcfgUbjFgGt7jlPB+ X-Google-Smtp-Source: AGHT+IEaalKABNvFq8hA5IDkWl0NW40bLXgL6uEkABdeFRg0fICeH725tSMKcNHWyqBMf6YTXhQ7Gw== X-Received: by 2002:a17:902:eccc:b0:1dc:4649:43df with SMTP id a12-20020a170902eccc00b001dc464943dfmr240246plh.16.1708703120763; Fri, 23 Feb 2024 07:45:20 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora , Saif Abrar Subject: [PULL 33/47] target/ppc: Update gdbstub to read SPR's CFAR, DEC, HDEC, TB-L/U Date: Sat, 24 Feb 2024 01:41:52 +1000 Message-ID: <20240223154211.1001692-34-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240223154211.1001692-1-npiggin@gmail.com> References: <20240223154211.1001692-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=npiggin@gmail.com; helo=mail-pl1-x634.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1708704411476100003 Content-Type: text/plain; charset="utf-8" From: Saif Abrar SPR's CFAR, DEC, HDEC, TB-L/U are not implemented as part of CPUPPCState. Hence, gdbstub is not able to access them using (CPUPPCState *)env->spr[] a= rray. Update gdb_get_spr_reg() method to handle these SPR's specifically. Reviewed-by: Nicholas Piggin Signed-off-by: Saif Abrar Signed-off-by: Nicholas Piggin --- target/ppc/gdbstub.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index ec5731e5d6..dfe31d0f47 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -394,7 +394,32 @@ static int gdb_get_spr_reg(CPUPPCState *env, GByteArra= y *buf, int n) } =20 len =3D TARGET_LONG_SIZE; - gdb_get_regl(buf, env->spr[reg]); + + /* Handle those SPRs that are not part of the env->spr[] array */ + target_ulong val; + switch (reg) { +#if defined(TARGET_PPC64) + case SPR_CFAR: + val =3D env->cfar; + break; +#endif + case SPR_HDEC: + val =3D cpu_ppc_load_hdecr(env); + break; + case SPR_TBL: + val =3D cpu_ppc_load_tbl(env); + break; + case SPR_TBU: + val =3D cpu_ppc_load_tbu(env); + break; + case SPR_DECR: + val =3D cpu_ppc_load_decr(env); + break; + default: + val =3D env->spr[reg]; + } + gdb_get_regl(buf, val); + ppc_maybe_bswap_register(env, gdb_get_reg_ptr(buf, len), len); return len; } @@ -411,7 +436,18 @@ static int gdb_set_spr_reg(CPUPPCState *env, uint8_t *= mem_buf, int n) =20 len =3D TARGET_LONG_SIZE; ppc_maybe_bswap_register(env, mem_buf, len); - env->spr[reg] =3D ldn_p(mem_buf, len); + + /* Handle those SPRs that are not part of the env->spr[] array */ + target_ulong val =3D ldn_p(mem_buf, len); + switch (reg) { +#if defined(TARGET_PPC64) + case SPR_CFAR: + env->cfar =3D val; + break; +#endif + default: + env->spr[reg] =3D val; + } =20 return len; } --=20 2.42.0