From nobody Thu Nov 14 17:58:19 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=1708331866; cv=none; d=zohomail.com; s=zohoarc; b=JJrjAmxt9twqjdwOrKXznXiLsWRo03ZGrE5VQ41PeHTYWXvgCCcetM/5Zn2n+HDP2UUgOu8tlF/aCzDiyup/GjZly7CYn+gG36fYb4HcuPtZDnEClvNMXTNdHD9q0C7VTQYEKwEpP4Q6FPNM35JvzvZPAmMQM4s1+QuBCYXzHzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708331866; 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=sIGwAEv7tWfbm8LJIqYCxKyeigVfLO6vfUaQ1pCq2VE=; b=E43d/ZoRmITEwXqBLUDx7Fjj9tQFIq2HUWV4JQ0RWiErqsP3pZNnJczj9zj3J69qWPajBg0Zal+yXantn0Zy664uEq7YU6FToXsUHzm3Mkk330rM8+WDtyESelS699CNbHRe4H+v71hodi6kjUAE/GgXqyWFovp8/CcSzSbTZVU= 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 17083318663431002.0322683152909; Mon, 19 Feb 2024 00:37:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbz5R-0007WS-Aa; Mon, 19 Feb 2024 03:33: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 1rbz51-0006Fh-OJ; Mon, 19 Feb 2024 03:32:52 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbz4s-0002gL-5v; Mon, 19 Feb 2024 03:32:50 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d94323d547so25675145ad.3; Mon, 19 Feb 2024 00:32:35 -0800 (PST) Received: from wheely.local0.net ([1.146.38.93]) by smtp.gmail.com with ESMTPSA id mo7-20020a1709030a8700b001db5ecd115bsm3838348plb.276.2024.02.19.00.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 00:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708331554; x=1708936354; 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=sIGwAEv7tWfbm8LJIqYCxKyeigVfLO6vfUaQ1pCq2VE=; b=ZPEFEJkZhXotcOq3Yk/ExyGMap1WFA1iN5wMXQWkOiGjUzkIm0BzKgNhSWc3UVNrLa VqUQVMPkS1vw+8qnhyRms98SmkAYB79LTKcYNh/HQspUIgykD+TOy70SFrDDPSv198Yw g0F12XpqWwMEPUi9bLofU7bIRkeXbqjoQKL2REFZ61/pGviGzzhcFz6WuDbVYeAcz/0N nun9zBcreIDMPZtvrVIFMTHvOMPe+hLAjgfbFrCJq97vBM8vvYStZY+RVfjr/QMjdK6k xvRlUqq5AT5w/UQctJywnGkgC9yo03eKG0XJgMPtUL2ipDGBP2pLP6IfxczbUuoguJuy 5axA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708331554; x=1708936354; 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=sIGwAEv7tWfbm8LJIqYCxKyeigVfLO6vfUaQ1pCq2VE=; b=Fnw8cgxagIVl0R2ZleI4vyGl3yuJdkiF4Ex72ve5lT3GhcYa89C3mR2ISn9lnQUAyN wfhY1NJpA9OGgajp7HONKd9/ITcV0HuXUq/mqM7+A5cByn2nnl7wT1uC3SXtw+W/bpwg lW46HFd/MfwK3Tbyp7mvb4g78J0eu4JSxd68jU7pO2KtnrlBluwsszSdXbPX/5ShTVPg KFPz5mZhLz0J5UNJ/3sUupnPH5e18OGUP8kckrzLVFe6VYjJ2eA/usSIN6EE8em4ba9S 8XvJD6dYguySMXLJtW1kvtly3S116AQXHTLsB+u13S6U1Es0wvlnMxxLsSEq0GPctZ+K 1ZXA== X-Forwarded-Encrypted: i=1; AJvYcCUZUYyW9NbtrrEobKvzGCfmyAlvUKf+78j9XDinWzSBIS53+ewvhgF43/QF8txV+4hnSmnTzABVslLcKGTaShSA/3Bx X-Gm-Message-State: AOJu0YxQmar1J11tA8s3NeNhb5KsEpEPZoAuw+2vKjf7OAVyoKXgdroc Qcv2LxvgIE8cxaO/dWZW0PlcWqkEu32LsIvexB+5XJgPBUPwHmdInS6fwpQC X-Google-Smtp-Source: AGHT+IGLpnObq3dScUhG5qouR/fHBDV/6MQhHinUHhejCalQqTOOnR9qgcx4lj7fsTM9kFOJHyKchg== X-Received: by 2002:a17:902:ce01:b0:1db:8eb2:9a11 with SMTP id k1-20020a170902ce0100b001db8eb29a11mr12907330plg.53.1708331554376; Mon, 19 Feb 2024 00:32:34 -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 35/49] target/ppc: Update gdbstub to read SPR's CFAR, DEC, HDEC, TB-L/U Date: Mon, 19 Feb 2024 18:29:24 +1000 Message-ID: <20240219082938.238302-36-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240219082938.238302-1-npiggin@gmail.com> References: <20240219082938.238302-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::62f; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62f.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: 1708331868345100011 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. 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