From nobody Fri Apr 4 05:57:40 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1742408686; cv=none; d=zohomail.com; s=zohoarc; b=eOzabMHDadEWSI8TkvEwMfDxffztN3lOwWw3bGt9t01dR4+icC4vX4OgDQXpVAPkQdpcCOpPcoceUgnH1sq/lq05CEFMqWJJuC9ixNo8X9sEbJ40k1doe5WvGoGyU7hKbb/eFGqsygGkvJDjS+TSvigs6PQf6mO//MkP49lPvqg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742408686; h=Content-Type: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=QJ83uXoZhI6xrj/GFa6jaX+FdXqwSbl+PFyWsW6Q49c=; b=Wn7gI+02efQRFI7rUR02UhN6BsyhGWKcGO1D4FffYwsVqZMpL0dT7dh3ZTGvsSFG4bamzao5rPnoRjljRSkk0GBTu+nVNN2rCw7roeIRUmmNIdKKDxkoDunMk63bJ9jvCMNcBtp4O/KF+zBnHxkXKNAl/0CB6cxQznk5V5vhZbE= 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 1742408686870111.53600992487645; Wed, 19 Mar 2025 11:24:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuy50-0000wo-Mv; Wed, 19 Mar 2025 14:23:53 -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 1tuy4N-0000Il-Qs for qemu-devel@nongnu.org; Wed, 19 Mar 2025 14:23:11 -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 1tuy4F-0006P5-EH for qemu-devel@nongnu.org; Wed, 19 Mar 2025 14:23:11 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43cf034d4abso52117185e9.3 for ; Wed, 19 Mar 2025 11:23:02 -0700 (PDT) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d4453227dsm25979735e9.40.2025.03.19.11.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Mar 2025 11:22:58 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 220CA6046F; Wed, 19 Mar 2025 18:22:56 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742408582; x=1743013382; 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=QJ83uXoZhI6xrj/GFa6jaX+FdXqwSbl+PFyWsW6Q49c=; b=SBBtDHfnHBUgCAW65l8bC4JXayScaO41zq06oW8USRmH3gsE+M9+Ls8K9X+nsNH49+ 1O912l2uxXglXW0W39UZ33LbF7+Zw7SYWhOOj5Q4qLgI02fukFnIAF507OORDuV2Y8Yr kyF14RjnqK0/lEDJkUO1m//0TsHrAjD5Ym2dGYdiHMZEufeXBe2E0GrZPVcO/9sUrfD2 rzK453D1PHtEEIvsr60FmsIOPakQPEqsiGOF1d1cdb2Hwq+bfjUOX9HcctX1KF8yG7za Fa5xfl0VbfLkAj8YPtd0qGHqkoIY/nFf9hbNRrNULVISWdXAojE7+3H9HB3qA+bBCJV0 ipeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742408582; x=1743013382; 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=QJ83uXoZhI6xrj/GFa6jaX+FdXqwSbl+PFyWsW6Q49c=; b=uovUqBXEUUOFr2/RJQp857yiEicdJUjTRl6K//bx3JDKF4ZdCymp23WYEbcRVVpLvs svJc0JIieW7ILgGcUNqrh8gbXU5TW7L6nAuK0lbtEIoCYso1oPBPfFLzqS2smUBEpHRE BNJYuuUZMH4VV6w2Sj+tZKHOx2KYkB7OS4SVxy+MTCce8vc4V9ID6U8UuF3axj/iccx9 qQMLIrCKOB5qZktkTTYr139q22am7hBkegXlBZBQMIDZJlDOh5pa/y344IWsX5koY4P+ GcmAFK9REiFTI+LY65JOyPTSl2ZxkfmHFL8VULsmJauB32mq9WQ6K9V9FIaPa8JcD+7t m8tA== X-Gm-Message-State: AOJu0YyPNw05J3ZA1JmvUO/EF90VC/eTgOSB6LInVUKUdVyL0+yJ5QgC wkbpzXFMaI77h3ZwjpOStTYYobSM/d/7gbaF8Ka43xXbjT5diAL646LdjvZTj4s= X-Gm-Gg: ASbGncv7kiQfrL7DTwXwO47Bmu4vWp8adhO/hQCi64VbpQc3v+VHsq8oIj9u6jBkNtA aXrwij5eL7WlCJneHm8VSfJTp7xgTFdsHL3GZ88KiDsIDVVmK5FD7N01nCPHuHReblrVgzIoIwq KXgs89jrHDWEyXfbYK1mwP9CTRBQ1qkeK4KKpWlllBArTuuvIKOsLYD7kn0MvzKdxzolDBBvZhY Xn9LYTVDsF+VznFRCF84Pl5OUjEB3EfAKihO/cPUWBsBPwdwTbyC1+stGAapH+xm3pxdUW5X3zW QiYh2NJU05k1HO0IbHR/XsMiXEXtfwVi/lZ8OwEJ0w7gAlo= X-Google-Smtp-Source: AGHT+IHCXoxgAWOy4Rm1AajpPx+hsUvXObOFncd3EukhGfK1fHOKOMY3YnlS2UH3CGqXRhK1UsQG/g== X-Received: by 2002:a05:600c:358c:b0:43d:7a:471f with SMTP id 5b1f17b1804b1-43d437c1881mr37941765e9.18.1742408581639; Wed, 19 Mar 2025 11:23:01 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Juan Quintela , Ilya Leoshkevich , Thomas Huth , Akihiko Odaki , qemu-ppc@nongnu.org, David Gibson , qemu-s390x@nongnu.org, Wainer dos Santos Moschetta , Peter Xu , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Daniel Henrique Barboza , David Hildenbrand , Yonggang Luo , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Beraldo Leal , qemu-arm@nongnu.org, Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Nicholas Piggin , Paolo Bonzini , "Edgar E. Iglesias" Subject: [PATCH 10/10] target/microblaze: convert gdbstub to new helper Date: Wed, 19 Mar 2025 18:22:55 +0000 Message-Id: <20250319182255.3096731-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250319182255.3096731-1-alex.bennee@linaro.org> References: <20250319182255.3096731-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1742408687998019000 This is a pretty simple conversion which will be trivial to update once TARGET_BIGENDIAN is replaced with a helper function. Signed-off-by: Alex Benn=C3=A9e --- target/microblaze/gdbstub.c | 44 ++++++++++++++----------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index d493681d38..106d6efbab 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -19,7 +19,7 @@ */ #include "qemu/osdep.h" #include "cpu.h" -#include "gdbstub/helpers.h" +#include "gdbstub/registers.h" =20 /* * GDB expects SREGs in the following order: @@ -50,62 +50,52 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *= mem_buf, int n) { MicroBlazeCPU *cpu =3D MICROBLAZE_CPU(cs); CPUMBState *env =3D &cpu->env; - uint32_t val; + MemOp mo =3D TARGET_BIG_ENDIAN ? MO_BEUL : MO_LEUL; =20 switch (n) { case 1 ... 31: - val =3D env->regs[n]; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->regs[= n]); case GDB_PC: - val =3D env->pc; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->pc); case GDB_MSR: - val =3D mb_cpu_read_msr(env); - break; + uint32_t msr =3D mb_cpu_read_msr(env); + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &msr); case GDB_EAR: - val =3D env->ear; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->ear); case GDB_ESR: - val =3D env->esr; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->esr); case GDB_FSR: - val =3D env->fsr; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->fsr); case GDB_BTR: - val =3D env->btr; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->btr); case GDB_PVR0 ... GDB_PVR11: /* PVR12 is intentionally skipped */ - val =3D cpu->cfg.pvr_regs[n - GDB_PVR0]; - break; + return gdb_get_register_value(mo, mem_buf, + (uint8_t *) &cpu->cfg.pvr_regs[n - G= DB_PVR0]); case GDB_EDR: - val =3D env->edr; - break; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->edr); default: /* Other SRegs aren't modeled, so report a value of 0 */ - val =3D 0; - break; + return 0; } - return gdb_get_reg32(mem_buf, val); } =20 int mb_cpu_gdb_read_stack_protect(CPUState *cs, GByteArray *mem_buf, int n) { MicroBlazeCPU *cpu =3D MICROBLAZE_CPU(cs); CPUMBState *env =3D &cpu->env; - uint32_t val; + MemOp mo =3D TARGET_BIG_ENDIAN ? MO_BEUL : MO_LEUL; =20 switch (n) { case GDB_SP_SHL: - val =3D env->slr; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->slr); break; case GDB_SP_SHR: - val =3D env->shr; + return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->shr); break; default: return 0; } - return gdb_get_reg32(mem_buf, val); } =20 int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) --=20 2.39.5