From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QDKwMg+b5GSqrAgAWB0awg (envelope-from ) for ; Tue, 22 Aug 2023 07:25:03 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=RpyMBZW/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CB7491E0C0; Tue, 22 Aug 2023 07:25:03 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A72A71E0C2 for ; Tue, 22 Aug 2023 07:25:01 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3767838930EC for ; Tue, 22 Aug 2023 11:25:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3767838930EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692703501; bh=lywIuztWfLZuZVgUlVg089Gh7BWvar6PU5OjwRA7h4k=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=RpyMBZW/mcbEY3y6AB6ZNebD+gDJSf+rhDG8+TTvxgIseij+bOcsF4JsaAfmnyb5s Z+wWKB3d/P4isd4UUsa//pzS91T3MuUaWqmdxj59w6DEVRY2ClrGw+4ZYuXcQvEsxk W730gben0184nDPTP+AgC+FxNCixsey94yEWnQhg= Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2047.outbound.protection.outlook.com [40.107.13.47]) by sourceware.org (Postfix) with ESMTPS id D37D13836E93 for ; Tue, 22 Aug 2023 11:22:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D37D13836E93 Received: from DUZPR01CA0354.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::6) by AS8PR08MB6359.eurprd08.prod.outlook.com (2603:10a6:20b:31a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 11:21:59 +0000 Received: from DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:4b8:cafe::69) by DUZPR01CA0354.outlook.office365.com (2603:10a6:10:4b8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20 via Frontend Transport; Tue, 22 Aug 2023 11:21:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT042.mail.protection.outlook.com (100.127.142.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6723.15 via Frontend Transport; Tue, 22 Aug 2023 11:21:59 +0000 Received: ("Tessian outbound 5c548696a0e7:v175"); Tue, 22 Aug 2023 11:21:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cc9941dde760c2c3 X-CR-MTA-TID: 64aa7808 Received: from 3fcae1047777.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 842075E5-4A5A-432B-8743-1C697A32631A.1; Tue, 22 Aug 2023 11:21:52 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3fcae1047777.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 22 Aug 2023 11:21:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqkwnJMdnRy+uW7ouCWCAkmlC33iz2yGXsyJNWxQp9sQ70ifEGIH6eWhZDvnVZlc4UXGCd7DjYIFoLUSmByDDMT/C8m0+Y/5QMMsfb9ebHDMCpiTN7q6gp76RFP9znhrZ/zRKVuIjokaDyliBYbi9KfYLrToNGsWY6Z/BYstqQlus2kG/1rCeYNldQ0MZQRcnL5I/S3Q8FX12phatxB6bgblT9iY4nn06C/di155HJ0Zs1fERXCGGA1wHRZEVMyx4hjnsA068hisuajrG3cfyyO1Y8HAoUV43BsDNxaYbMKkyHIbtwaIMRi/4/OjIQnqkKJ48BpKzVDGZllTCHB8/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lywIuztWfLZuZVgUlVg089Gh7BWvar6PU5OjwRA7h4k=; b=nlaQll5+Bu0NlS9JCSZMZBPfaxVNWqJPIQu/rHagbiSoyuzMO1F/Pa05lIjcsSG5qh7cWpA1awEUrXVthFsJAjGz4p1XlKWyU7Vj9OWxpKbjmpyP1NwmRT+1qmi1Rm1vl4jz/gPDiuDXVmw+kDBcfAzOCYS9BXQxiNLUJmRdgQVETotWD0pcS20xuCfhWAZKFbcNrNCsfKVqu3q145pz9X5ODQn2vzo4wLucPFAxq52pniZPlRaxDkbxx8vt8Z2xzh/PRLnjMlZZ/C95+qqg7Dz4ZWu8NxIEkbHptToIexVrprfdI+BlIq7gWfqwa1tgOQ6qSnk3tH5kbpTZA477OQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS9PR06CA0776.eurprd06.prod.outlook.com (2603:10a6:20b:484::33) by DB4PR08MB10343.eurprd08.prod.outlook.com (2603:10a6:10:3fd::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 11:21:50 +0000 Received: from AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:484:cafe::13) by AS9PR06CA0776.outlook.office365.com (2603:10a6:20b:484::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20 via Frontend Transport; Tue, 22 Aug 2023 11:21:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT034.mail.protection.outlook.com (100.127.140.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6723.15 via Frontend Transport; Tue, 22 Aug 2023 11:21:50 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 22 Aug 2023 11:21:46 +0000 Received: from e129171.cambridge.arm.com (10.1.34.58) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Tue, 22 Aug 2023 11:21:46 +0000 To: CC: Subject: [PATCH v2 4/6] [gdb/aarch64] sme2: Core file support for ZT register set Date: Tue, 22 Aug 2023 12:21:42 +0100 Message-ID: <20230822112144.1513268-5-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230822112144.1513268-1-luis.machado@arm.com> References: <20230822112144.1513268-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT034:EE_|DB4PR08MB10343:EE_|DBAEUR03FT042:EE_|AS8PR08MB6359:EE_ X-MS-Office365-Filtering-Correlation-Id: e6859b5f-5541-47b9-a819-08dba302002f x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0H80NnC50u5f8U/NEOYb4kFdYe6MMksFIg0Z8LK0Pcy+7E/mdb8uRK9XdGXfAOjJAS6kBZlg25jwPsIZI3+RAyU8uAuQps3VNyTLYS+aV5vhgpSwWhhIu4aGrSyR7weiCh0qHvJbvr2gTVEcdyAvEjlmCLbCSTy+xnxvBNpLIIkQO1GG0JMVVUcSGe1396a1Yq9Bx0wOg7C63WQdVC5DwOvw3Rj9ovLlaZqfkMiIfS7qdxDCDKjq85pO095fp606l40mmXwZGzpOLPiTZvb+qAU+ltSmMfTPL/0XpAsiXHnE5E083uDBVveIzbdStOdyQZ95lidh06cOQYQ5zTBRJYCE/AnQI7WfbGuAgfBEQ8f1qG+Xb20JjiRN3sT5qXkISCrfYe9Da4YSmDgwSRoDBmEFtDyJcAOnS3wySoOn36+i5Dmwfsvy/2RqPhwuFdySbrxgToZpOJL+OgxFVsi5RCGhpv26BBTgQt7V8LA8bu/W6OOXvEDh4OFPZIYV8ybuOfHVMy44e6esywSPaIrZ7wjyWXKPS6iiEzIERDydizMtttEeGvgnBvd94xKYsl5soBKzF1s8cdaMw9tHvVB1pj5qX0oAiCybdJOfay0q8alJKhGXRLE6a+I3vYhEfgs0M9DSSAB+SKYsQn148Syw02qIAHkU0DKU4/W2eBJ8lKykqonDferaJD0I+UbnDV0xqaoOwJdfwDouIHdIU7EImx+u2nZ7d97N041JkMlHLlgDwsznTgam8CruExFKE3No X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(376002)(346002)(136003)(39850400004)(396003)(451199024)(186009)(1800799009)(82310400011)(36840700001)(46966006)(70586007)(70206006)(6666004)(8936002)(8676002)(4326008)(7696005)(36860700001)(26005)(2616005)(478600001)(41300700001)(316002)(6916009)(5660300002)(1076003)(44832011)(426003)(336012)(83380400001)(2906002)(86362001)(36756003)(40480700001)(47076005)(356005)(82740400003)(81166007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB10343 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 24f49f98-53f7-46f0-fa2f-08dba301fb1d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SlNH1u1S1i/6JXBtryD5/PkXLfvzF9b6yWb1d/4gCvcKagPUrRiHdp8k0hJvKsOa+Hu2kkrqduA5VNX9Pr6AbE5S33XJt2xCs7Lk6PSRRUjIP/bUoLeNOg6WF59SJjYZDesbzLXsnx3V180/T50gz8lx21Z8YAnu7rgHfXcb+XqWo1QCc0FvZTAtPNhwkw12tcfhDPYKLJQh6m+j5jJnML0AmztlalIv6XS1yyrcjkU6vjHg+xU40CD9V5HN6W1qQUU00/M7fiAo/jD9qZv3NXuLvXw/ngus3sN2O09RzLjv0AYlI5/wdszNAD/PbSHA3ylSnyJDC+ZWz2IRScTkuSweG30IJ8QPS+cdCyWp+4PW91MCsfzbCfgO0M6qODEJsLAF8bVuozLH7UpfDys/4hADD+0CrNKEGUGk37+tWB8ifF1o8H8BZQc77gVnk0g9D3LADU9JG4MBEW0S8ozz02s9Dob4w+JVxTZZFNwsNyc6AvyB5jF2mMLw/QbVdXO25qZ798OTgeXk5JunuQjlw7yyEtPN99rhY1aNltfjzmSBVUpMr82k/q1hEh2Th5EM/TP8hGY6aWXKea60/Vh+x5a3ab5YQ0p9XsBTIVPiz1LnfIscnos43+2t/Llis+MxeptFfN9mxJbzhFbjbC1Tk2hiCh5U30Gdb2tHCaLaq6TiYpwrH9uyJoLiJ6gmak61NuqKeo8KOVFqssmWbJLKO0IdTFguDKHfUYi/1JtGYQsLH4dsd4EvBlS2q5Xb6cLJ X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(136003)(376002)(396003)(39860400002)(346002)(1800799009)(186009)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(6916009)(316002)(70586007)(70206006)(8676002)(8936002)(2616005)(107886003)(4326008)(36756003)(40460700003)(41300700001)(1076003)(82740400003)(81166007)(478600001)(6666004)(40480700001)(83380400001)(2906002)(86362001)(47076005)(7696005)(36860700001)(336012)(44832011)(426003)(5660300002)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 11:21:59.1286 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e6859b5f-5541-47b9-a819-08dba302002f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6359 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This patch adds support for ZT register dumps/reads for core files. The ZT register is available when the SME2 feature is advertised as available by the Linux Kernel. Unlike the enablement for SME1 and the ZA register, support for SME2 is rather simple given the fixed size of the ZT0 register. Validated on the Fast Models. --- gdb/aarch64-linux-tdep.c | 81 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 8b0b4d32971..a4d1fb87cbf 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -1374,6 +1374,50 @@ aarch64_linux_collect_za_regset (const struct regset *regset, size - SVE_HEADER_SIZE); } +/* Supply register REGNUM from BUF to REGCACHE, using the register map + in REGSET. If REGNUM is -1, do this for all registers in REGSET. + If BUF is NULL, set the registers to "unavailable" status. */ + +static void +aarch64_linux_supply_zt_regset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *buf, size_t size) +{ + /* Read the ZT register note from a core file into the register buffer. */ + + /* Handle an empty buffer. */ + if (buf == nullptr) + return regcache->supply_regset (regset, regnum, nullptr, size); + + aarch64_gdbarch_tdep *tdep + = gdbarch_tdep (regcache->arch ()); + + /* Supply the ZT0 register contents. */ + regcache->raw_supply (tdep->sme2_zt0_regnum, buf); +} + +/* Collect register REGNUM from REGCACHE to BUF, using the register + map in REGSET. If REGNUM is -1, do this for all registers in + REGSET. */ + +static void +aarch64_linux_collect_zt_regset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *buf, size_t size) +{ + /* Read the ZT register contents from the register buffer into the core + file section. */ + + gdb_assert (buf != nullptr); + + aarch64_gdbarch_tdep *tdep + = gdbarch_tdep (regcache->arch ()); + + /* Dump the register cache contents for the ZT register to the buffer. */ + regcache->collect_regset (regset, tdep->sme2_zt0_regnum, buf, + AARCH64_SME2_ZT0_SIZE); +} + /* Implement the "iterate_over_regset_sections" gdbarch method. */ static void @@ -1462,6 +1506,30 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, SVE_HEADER_SIZE, SVE_HEADER_SIZE + std::pow (sve_vl_from_vq (tdep->sme_svq), 2), &aarch64_linux_za_regset, "ZA register", cb_data); + + /* Handle SME2 (ZT) as well, which is only available if SME is + available. */ + if (tdep->has_sme2 ()) + { + const struct regcache_map_entry zt_regmap[] = + { + { 1, tdep->sme2_zt0_regnum, AARCH64_SME2_ZT0_SIZE } + }; + + /* We set the register set size to REGSET_VARIABLE_SIZE here because + in the future there might be more ZT registers. */ + const struct regset aarch64_linux_zt_regset = + { + zt_regmap, + aarch64_linux_supply_zt_regset, aarch64_linux_collect_zt_regset, + REGSET_VARIABLE_SIZE + }; + + cb (".reg-aarch-zt", + AARCH64_SME2_ZT0_SIZE, + AARCH64_SME2_ZT0_SIZE, + &aarch64_linux_zt_regset, "ZT registers", cb_data); + } } if (tdep->has_pauth ()) @@ -1567,6 +1635,19 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, features.svq = aarch64_linux_core_read_vq (gdbarch, abfd, ".reg-aarch-za"); + /* Are the ZT registers available? */ + if (bfd_get_section_by_name (abfd, ".reg-aarch-zt") != nullptr) + { + /* Check if ZA is also available, otherwise this is an invalid + combination. */ + if (bfd_get_section_by_name (abfd, ".reg-aarch-za") != nullptr) + features.sme2 = true; + else + warning (_("While reading core file sections, found ZT registers entry " + "but no ZA register entry. The ZT contents will be " + "ignored")); + } + return aarch64_read_description (features); } -- 2.25.1