From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2079.outbound.protection.outlook.com [40.107.21.79]) by sourceware.org (Postfix) with ESMTPS id CA5183870C2B for ; Fri, 30 Jun 2023 13:45:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA5183870C2B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aLsEzQXyKFJ47AvVCGEGVvDR4TD4Cm5Qe7lAtIL3F4w=; b=pK3uaaXCJ3XSIxgoNRdgtGAAosW3sBXRAjrxy7vwYjk0v/Q9j0GUpwM93l4lbF0ErLH8wkMbre+tHrGyJ5h5OsPPu2E6FCcHDAEykdvp2/kblp7am3+xNaMEeUsst/hena3Sva0k2h6UepMbVEev4N4owsk1V4axEhtOoQwpoiQ= Received: from DU2PR04CA0184.eurprd04.prod.outlook.com (2603:10a6:10:28d::9) by AS8PR08MB6312.eurprd08.prod.outlook.com (2603:10a6:20b:298::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 13:45:47 +0000 Received: from DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28d:cafe::29) by DU2PR04CA0184.outlook.office365.com (2603:10a6:10:28d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 13:45:47 +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 DBAEUR03FT055.mail.protection.outlook.com (100.127.142.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.13 via Frontend Transport; Fri, 30 Jun 2023 13:45:47 +0000 Received: ("Tessian outbound 546d04a74417:v142"); Fri, 30 Jun 2023 13:45:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 43f8e4c8d5ea60ca X-CR-MTA-TID: 64aa7808 Received: from 5256831f104e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 25CCFA8C-E4C0-4424-A855-30612C347537.1; Fri, 30 Jun 2023 13:45:40 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5256831f104e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 30 Jun 2023 13:45:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1myZQUvckJuk6dtuFUMM3/OtVCOURkxXcCuWxgPeu2jjvRHeXbijpbBjnQbmW0l5fSuAfH060npL4l58VWS+G5MLXu+/sstQ2dNC3daEoUUPmDFOnbrDzoUKCsifri6FlQzJmEou056mXIFwKSFj0XhE0saYL7tQ90jtP2sZyPVb8QlFvXescS8UzHGI0Gn2s6dL05V8j6a6G6BgBaVPErkZE0q0m50C2fnxXt3yNd1H8WyO2gwDiSpeRp++oM/SaYD74rJQEdCgFZoPGZCOSHAM0F0TAshEBDnYkHrwpfVq4t1SSly/K0wr3Ebazw6Hw3aDqcORpGl5QGG7gTCag== 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=aLsEzQXyKFJ47AvVCGEGVvDR4TD4Cm5Qe7lAtIL3F4w=; b=Ob8K7Qotf12ogOg8darlopdvnNwgj6T+UOnB+KISXf0vy6jbmM2AB8jIsWt69fmlQD5cU53bM8jYXHHWq+yeqxIHvhLUqpsXgoKvxFpd4htjvZSGatDPv0Abxa9sFgYlVQx5IAG/DMhFLDiwls6cP+XLtn6diLZzXZq/85f8Q5gEvzjDOR/QToX6+5jsFjd8+U0orpNYT6C/jqQfj+Yv97MZLq9jvSwz3DLtJKhkdhqMz3HzHZFRUta1nEi1UdAqj8QQ5uQGfQm8yaDhcQqM6Vea+T+ziC2k9Qz/QmKEg1iKzRSAmDMKyeLah0lrYi3s/nsvDcG5ZSKnU6o71+ISXw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aLsEzQXyKFJ47AvVCGEGVvDR4TD4Cm5Qe7lAtIL3F4w=; b=pK3uaaXCJ3XSIxgoNRdgtGAAosW3sBXRAjrxy7vwYjk0v/Q9j0GUpwM93l4lbF0ErLH8wkMbre+tHrGyJ5h5OsPPu2E6FCcHDAEykdvp2/kblp7am3+xNaMEeUsst/hena3Sva0k2h6UepMbVEev4N4owsk1V4axEhtOoQwpoiQ= Received: from AS9PR06CA0603.eurprd06.prod.outlook.com (2603:10a6:20b:46e::12) by GV2PR08MB8631.eurprd08.prod.outlook.com (2603:10a6:150:b3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 13:45:38 +0000 Received: from AM7EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46e:cafe::6b) by AS9PR06CA0603.outlook.office365.com (2603:10a6:20b:46e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 13:45:38 +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 AM7EUR03FT027.mail.protection.outlook.com (100.127.140.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 13:45:38 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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; Fri, 30 Jun 2023 13:45:36 +0000 Received: from e129171.arm.com (10.57.27.17) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Fri, 30 Jun 2023 13:45:36 +0000 From: Luis Machado To: Subject: [PATCH] [aarch64] sme2: Teach binutils/BFD about the NT_ARM_ZT register set Date: Fri, 30 Jun 2023 14:45:19 +0100 Message-ID: <20230630134519.1237879-1-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT027:EE_|GV2PR08MB8631:EE_|DBAEUR03FT055:EE_|AS8PR08MB6312:EE_ X-MS-Office365-Filtering-Correlation-Id: d71c7e80-b010-46f3-c318-08db79704f23 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: cwJRlt9NwrGKUdGahos2greGDlq/DTWMeWgjHV+AdLvfoxCldZU3QBWx2bkH4vVj6yh3njsDYBhzIZjmX2urBcUErJbyJ6dKwBrqrgbQLXaqghhcLo1D1ABlCqMpO5isKO3NeJ3U2rOirNuChspxMmAImMW6s6ky/FrUQM4h3Bi5hWpG8tOKWA5hvAZQKcUu20rX7OeUs9uVktr64rPrEc6ir3AynO8Mw7/qxUbN5x/oR7S7V0Y8uIVrVbvDMGh3ONMMj+JAi9dzuUpA37jsM606Qp8hBZxFuEfsBNEvZL84ffhh82uSXGXjVmf7v98GZh3DUO9E81RFVJpJLzhRIsL8uOfWFj0K/xwTgkmnYVGq3KpwKMsZZ8XbBS4/azrSFkLs4xFop2n+zpQkAdkZUFz2VvR5BicLKrhfqBZbRqX66mxI4C2aV2P0hzXQB6eMvrLo3oZSRL/NIh2a1x1Oasc/nchIh21BdMWTHIm/IGZpFJ9fzhkAQ/i6yPUjVeeWVvrEsVWWPlmYCxG+mwHHtoOWrIgJPrh3Bvni53uQzpP2fjeQMPlhQPC4UL+USZo5X1PkDDxPS75EV96Gc/O/c4VJ6Y9PwouTyeshcNE5COHDnNEjl4LjOgqGu5riNngIl0Ttc5xXZAM0lGqgk2oQCg6aYhT85poPFAPNcyteL65VMK6W475hWCuGasiGKRFW9wcvlZvdqgWLk7CqGV+KlvVuOYnrhDHC/LC1OdxqLy2wnd9OBult8+2OlaqA0V4KDdTRU+IMdYvkc9+rG+zwOg== 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:(13230028)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(478600001)(6666004)(7696005)(1076003)(26005)(186003)(70586007)(70206006)(2906002)(82310400005)(41300700001)(316002)(6916009)(8676002)(5660300002)(44832011)(8936002)(81166007)(356005)(82740400003)(36860700001)(86362001)(36756003)(47076005)(2616005)(426003)(83380400001)(336012)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8631 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 32310ad4-f7aa-448e-1e06-08db797049a0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2VgjYIDUh7PEzaPHre6dvx0xysgy+sBLdFBHGadzi/SM/g9lOPJ05qpLABhD8Z8MyZ3C5Vhlv+hoobq4+aVzqDQECdxwV0H1gGF0neTTzXJd+Jd3m8DznE2kFj0odWX4yYuHPj0pYEwKJCh/5/W8dP6xOou/KTv4Lg2om/NXfzAWJY4LzPdnCkcEx2bTjvVY6sZDbPEOhYw7cWldTM3CMy4v+f1ulw9h9olu3DBX2rZPjJN4JStJV/+pAifSOydHDBdcKXRiqs1g8CnkpSQjW7GCV/OeBDe+8nJ/cg06yYAst+AnTijasBmo3fuSJk+9VSvYWq4YgXdbEZRWyvyL1OwQu2LOcoMGZuNp+wdFTzTH0VBgC0Jj+OzfeACttxdLdUSqviE3xTrTZuOpvtjLY5VXRHXdQTrJOR88yO6x9lP9P+Qh/EFXjvCLzqC6S5GG85kYE2AHFmvt2bq8kR/EYkXxtc46QJSkWkViY51y6Wi0k+HTqyI+YipuqzfshT4MbwUBPhOxAqqbFJo/1K/2RVGQsDrha15OjUTZ+0uw1BitzRyz1OeSLI0mm8lPZLoI/sFSNrE67tGUIOMfMYYfcsj0PyAk0CBEUQ4quu+PS47o3mq+4yqbSYVatk6Ss4rRhxQsv2wiaA7sVmpfe+j9tyn3oz3NMrm+RX6TiufUbk0joPmgxiivA00cne4FiKz2Wg8z/Y6ast9ysRBtPX9BXc5dcug8dD1YWLV2Yi17B2bngcnpDF+UKKLujl4vmJd1 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:(13230028)(4636009)(136003)(346002)(376002)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(8676002)(8936002)(5660300002)(36756003)(478600001)(6916009)(7696005)(6666004)(70206006)(70586007)(40460700003)(316002)(41300700001)(40480700001)(81166007)(47076005)(186003)(44832011)(2616005)(1076003)(26005)(336012)(426003)(83380400001)(82310400005)(86362001)(36860700001)(82740400003)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 13:45:47.3942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d71c7e80-b010-46f3-c318-08db79704f23 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: DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6312 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,T_SCC_BODY_TEXT_LINE,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 List-Id: The Scalable Matrix Extension v2 (SME2) defines a new register, ZT0, that the Linux Kernel handles through a new NT_ARM_ZT register set. Teach binutils/BFD about it so that gdb can make use of it for reading and writing core files. This also enables readelf/objdump to show the correct identification for the NT_ARM_ZT register set. Validated under Fast Models. --- bfd/elf-bfd.h | 2 ++ bfd/elf.c | 37 +++++++++++++++++++++++++++++++++++++ binutils/readelf.c | 2 ++ include/elf/common.h | 2 ++ 4 files changed, 43 insertions(+) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 2a9eed7f9ee..0baee5acfa6 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2943,6 +2943,8 @@ extern char *elfcore_write_aarch_ssve (bfd *, char *, int *, const void *, int); extern char *elfcore_write_aarch_za (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_aarch_zt + (bfd *, char *, int *, const void *, int); extern char *elfcore_write_arc_v2 (bfd *, char *, int *, const void *, int); extern char *elfcore_write_riscv_csr diff --git a/bfd/elf.c b/bfd/elf.c index 2a097b02977..e8ab2546d91 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -10692,6 +10692,15 @@ elfcore_grok_aarch_za (bfd *abfd, Elf_Internal_Note *note) return elfcore_make_note_pseudosection (abfd, ".reg-aarch-za", note); } +/* Convert NOTE into a bfd_section called ".reg-aarch-zt". Return TRUE if + successful, otherwise return FALSE. */ + +static bool +elfcore_grok_aarch_zt (bfd *abfd, Elf_Internal_Note *note) +{ + return elfcore_make_note_pseudosection (abfd, ".reg-aarch-zt", note); +} + static bool elfcore_grok_arc_v2 (bfd *abfd, Elf_Internal_Note *note) { @@ -11421,6 +11430,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) else return true; + case NT_ARM_ZT: + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) + return elfcore_grok_aarch_zt (abfd, note); + else + return true; + case NT_GDB_TDESC: if (note->namesz == 4 && strcmp (note->namedata, "GDB") == 0) @@ -13063,6 +13079,25 @@ elfcore_write_aarch_za (bfd *abfd, size); } +/* Write the buffer of zt register values in aarch_zt (length SIZE) into + the note buffer BUF and update *BUFSIZ. ABFD is the bfd the note is being + written into. Return a pointer to the new start of the note buffer, to + replace BUF which may no longer be valid. */ + +char * +elfcore_write_aarch_zt (bfd *abfd, + char *buf, + int *bufsiz, + const void *aarch_zt, + int size) +{ + char *note_name = "LINUX"; + return elfcore_write_note (abfd, buf, bufsiz, + note_name, NT_ARM_ZT, + aarch_zt, + size); +} + char * elfcore_write_arc_v2 (bfd *abfd, char *buf, @@ -13248,6 +13283,8 @@ elfcore_write_register_note (bfd *abfd, return elfcore_write_aarch_ssve (abfd, buf, bufsiz, data, size); if (strcmp (section, ".reg-aarch-za") == 0) return elfcore_write_aarch_za (abfd, buf, bufsiz, data, size); + if (strcmp (section, ".reg-aarch-zt") == 0) + return elfcore_write_aarch_zt (abfd, buf, bufsiz, data, size); if (strcmp (section, ".reg-arc-v2") == 0) return elfcore_write_arc_v2 (abfd, buf, bufsiz, data, size); if (strcmp (section, ".gdb-tdesc") == 0) diff --git a/binutils/readelf.c b/binutils/readelf.c index 97d72d0b95f..d1c7e5aa450 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -19654,6 +19654,8 @@ get_note_type (Filedata * filedata, unsigned e_type) return _("NT_ARM_SSVE (AArch64 streaming SVE registers)"); case NT_ARM_ZA: return _("NT_ARM_ZA (AArch64 SME ZA register)"); + case NT_ARM_ZT: + return _("NT_ARM_ZT (AArch64 SME2 ZT registers)"); case NT_ARM_PAC_ENABLED_KEYS: return _("NT_ARM_PAC_ENABLED_KEYS (AArch64 pointer authentication enabled keys)"); case NT_ARC_V2: diff --git a/include/elf/common.h b/include/elf/common.h index ffa6b60bd2b..932ea94e3ae 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -701,6 +701,8 @@ /* Note: name must be "LINUX". */ #define NT_ARM_ZA 0x40c /* AArch64 SME ZA register. */ /* Note: name must be "LINUX". */ +#define NT_ARM_ZT 0x40d /* AArch64 SME2 ZT registers. */ + /* Note: name must be "LINUX". */ #define NT_ARC_V2 0x600 /* ARC HS accumulator/extra registers. */ /* note name must be "LINUX". */ #define NT_LARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */ -- 2.25.1