From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2083.outbound.protection.outlook.com [40.107.8.83]) by sourceware.org (Postfix) with ESMTPS id 0B816385841E for ; Wed, 13 Sep 2023 10:18:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B816385841E 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=ZOPi7WGyWxXrTdZXsi2NEorP5bRKWZLNeMRstsSsDjw=; b=rDCQdG7M4yA/KnycRQdVH6HbKlSlb3VyVSahZNIPYgUMWeK8pNYewmSk6dS3HbdZW/9sWuVTlFh/LqTTB1I4x/a3PxsLWp+SWKy8BdNGWowHYgtry6N+Zr5S6VmmSUVArqp7VIp5jSjEp6v+G6ujp29zDVAAzblpVDmdKqS/Hrs= Received: from AM6P191CA0103.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8a::44) by AM8PR08MB6385.eurprd08.prod.outlook.com (2603:10a6:20b:36a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.37; Wed, 13 Sep 2023 10:18:40 +0000 Received: from AM7EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8a:cafe::f5) by AM6P191CA0103.outlook.office365.com (2603:10a6:209:8a::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19 via Frontend Transport; Wed, 13 Sep 2023 10:18:40 +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 AM7EUR03FT017.mail.protection.outlook.com (100.127.140.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19 via Frontend Transport; Wed, 13 Sep 2023 10:18:39 +0000 Received: ("Tessian outbound 5c548696a0e7:v175"); Wed, 13 Sep 2023 10:18:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dcf1fdc898ef692c X-CR-MTA-TID: 64aa7808 Received: from 53f489a658c9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DB1C671C-4BE0-4BA9-B380-2E59861F8B5C.1; Wed, 13 Sep 2023 10:18:33 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 53f489a658c9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Sep 2023 10:18:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KlGJv2QE2szOSqGG3mXf7489HX9p9dtyeO1NXEEqfLFlkPuXUME4nf0mVrUdXvGNwGiZ2qCZb9bhV3Ao+51jmD2ySj1Blm892Zy7uImHEuF8zkA20Rwm4TXayM43YST1/Zw63sfY9B24NmPSwYl2/E5EC8oIvDRUw2D5uvYBoT8fNcj6bQjW9Zv41eDZnsaYxtz2/CgkGIUaYPvL/G6lXUgogi0Vg/V1yexoBhoMKibql84Xk4m8QPDLOuzhMAhYZG5GejF7bexVvbWQHVr9PYMdJqqPFn+07MyG0G3ygHtYDUKjFQEzT1m79Ks73XbmW1PQxbYEdjAPu38In7V0dw== 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=ZOPi7WGyWxXrTdZXsi2NEorP5bRKWZLNeMRstsSsDjw=; b=iV5HpmPt2nP6ZVO8vOZnMTezlD6IyDWcClArjolYcZk4/s7HpVndxrSQBvQVEM1CxVwxRZcdisrEDtUMJK1k0VQfnRxHXPOdawm43kq7M/AreKlTWf8TFqrIW40XXTARjvxq2OnkGg4btY12AkMDqcBbRHrcewpfsJnOsR/rD3yhvWB/LZTIEzFhIEgYjW4oaKY/uxylsLXFnXtBrbmBH7/CjitbB5abb9GUSS0GGhCZHCSdZVkd1PJiiHT8SKIDwXvruHF6cgQoRnSthEyPKJ4J4GYu+sjokQpL4IY3lO5Fe7PIim/11FX8V0WW68K1TJf/kCQwmP8y037mm/sN8w== 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=ZOPi7WGyWxXrTdZXsi2NEorP5bRKWZLNeMRstsSsDjw=; b=rDCQdG7M4yA/KnycRQdVH6HbKlSlb3VyVSahZNIPYgUMWeK8pNYewmSk6dS3HbdZW/9sWuVTlFh/LqTTB1I4x/a3PxsLWp+SWKy8BdNGWowHYgtry6N+Zr5S6VmmSUVArqp7VIp5jSjEp6v+G6ujp29zDVAAzblpVDmdKqS/Hrs= Received: from AM6PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::42) by PAXPR08MB6717.eurprd08.prod.outlook.com (2603:10a6:102:131::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Wed, 13 Sep 2023 10:18:30 +0000 Received: from AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::a2) by AM6PR10CA0101.outlook.office365.com (2603:10a6:209:8c::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19 via Frontend Transport; Wed, 13 Sep 2023 10:18:30 +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.6792.20 via Frontend Transport; Wed, 13 Sep 2023 10:18:30 +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; Wed, 13 Sep 2023 10:18:29 +0000 Received: from e129171.arm.com (10.57.66.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Wed, 13 Sep 2023 10:18:29 +0000 From: Luis Machado To: CC: , Subject: [PATCH v6 10/17] [gdb/aarch64] sme: Signal frame support Date: Wed, 13 Sep 2023 11:18:08 +0100 Message-ID: <20230913101815.178154-11-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230913101815.178154-1-luis.machado@arm.com> References: <20230913101815.178154-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_|PAXPR08MB6717:EE_|AM7EUR03FT017:EE_|AM8PR08MB6385:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f02be89-6a82-4a00-b388-08dbb442cccf 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: jgHHlzSrlnRF5P1Dx2u5sHR2e6zZ0JLsFzdU2ZY3IAxMocZwa41op8drBu3e1WyJhDWVfviMYv5cgBWZQJN990wzDb1CoZHmglR8YMhXwQiVpX32sUPs45MKJSdkyb/WjbKB5Rh8LL7yZnn4YnphpLZMq4VUbuaGf8XR/EZipOY/8LXS55Vy2TGxStJBzcpmOUCGu2LEB5ZPymNLkXCCGb4rJuUhjMr6o8Z+S3CAUTqRB8A8Sw0W9yhgTdbCKHsgYs62c5p/i1GZVhS0S/j+c0rXYvLPZUuQswJvXIvU9jbuzp/iy5jpCB9tpY/qoENS8iFtmVNahlOWu6YDGalROsaqiWbeiujS3x5Hn0L4RPfxve4ieb1DD+Ke1Adj2/2OmIJx3GsUg13WchA6sHGCD6HM9d0xIV8mBabzsXas7YiXZX5MUd38O2ZQzFOm8m8+L4yFmrA7x2giwwA8lF96LHSWob+t4X0TCB1Vzp+mL9Oj+M2A7rKjpq0Zm31KCAA2mpHOC1KroLzjHYpE79QM35lUJ+49cJieaewMXOP82R4bis8UN5uiai7B/3F0RCKK9Cy4YK5H2M/3wlwBj7LV+DAtYzzci6zbmIp0FycZjZPfNtiSndXKiC+gRMof3IazYK8um5Tpu85Jd9bwBgRDHtuZ6YVuxQ+D/lqogNX+j9hJzVL4FxFFjupGRqqibXYZnooZoEvG2XuAQg0+0sHfaiVPt490/6JOMJ+pGfDh2+muR0VWe6Iuezv6OqGRrgRJV5zj/NceQlFB81clB1xIxQ== 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)(136003)(346002)(396003)(39860400002)(186009)(1800799009)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(44832011)(1076003)(426003)(336012)(86362001)(83380400001)(26005)(2906002)(7696005)(2616005)(6666004)(40480700001)(36860700001)(81166007)(82740400003)(40460700003)(356005)(47076005)(36756003)(478600001)(41300700001)(8676002)(8936002)(5660300002)(4326008)(54906003)(70586007)(70206006)(6916009)(316002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6717 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ec1165a7-afa5-4b65-7295-08dbb442c6f8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2BTqK7cKQdEsq/MSdFPYqtgs8dIbv5QM+uKVtUcLP737AR0tCbU0JDr110gojpK3BOZ61DTkETPyd+zM5M5EpvmL/WB3cLCIwNLSalLSRiSyWnvkzilERFmxVx+g50Rj6+hqzqW7wdXmDdokp3//7bBoPOV1OUFAMyLUlLu4AQPS8WSDmjPcis6UcPhJ3skZwCi37awORDJQ7ux1xhivVY+y8KHXpOlQrIInakQeq83vOTNw1m/H5EelvKXwJX1zoFKNKchJRQx4UG1IvREws4V+WlKhSX8ts8tvzF6SOvvpAsGWh92QIsB9Ge8ONATSVPQJ9Ib0AalKWQqaKTZbOp4nvTTln/btbMIQDZySaBAO+2fG5jIgyBVFH3p/Bxt6yqEQAda084XR1tz/8FtnL2QEvRAyUXTTLR5jDbQLqVPFso7RXyvQzP59efIrAjG4LVEkHxytxchssOC4IyaeVV682fO5AuOcKmjcq55Gxz8EDsRmLr29dosvGhT9LB8InLEXTKE34+SVBJ7aXDmcMMQgDBPuXCMZP2RREVAEvOfzx0wedx7NpnGmhtFJSP+R4MnSbU04WIAjBuCzHUL/5GFdoYdnDSDBSU+aKLtjNMiqfdGZ0RSVTS4IQYuY6iN7RL7qV7PXwIKtol+GkDqHORvEvAUaPrGKE5IfIdaquNc8ECzIdXnc18meGgOjPlWONP15/e0i+HO7ZLJLKuHp7yn50W93t+IkOXok8bzCnML4hK2g8fWnXpxRmF4tNbuJ 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)(39860400002)(376002)(346002)(396003)(136003)(451199024)(82310400011)(186009)(1800799009)(46966006)(40470700004)(36840700001)(86362001)(40480700001)(5660300002)(44832011)(8676002)(8936002)(40460700003)(2906002)(4326008)(36756003)(26005)(7696005)(82740400003)(6666004)(1076003)(478600001)(107886003)(336012)(2616005)(81166007)(426003)(47076005)(36860700001)(41300700001)(83380400001)(70206006)(70586007)(6916009)(316002)(54906003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2023 10:18:39.9281 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f02be89-6a82-4a00-b388-08dbb442cccf 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: AM7EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6385 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 List-Id: Teach gdb about the ZA/SSVE state on signal frames and how to restore the contents of the registers. There is a new ZA_MAGIC context that the Linux Kernel uses to communicate the ZA register state to gdb. The SVE_MAGIC context has also been adjusted to contain a flag indicating whether it is a SVE or SSVE state. Regression-tested on aarch64-linux Ubuntu 22.04/20.04. --- gdb/aarch64-linux-tdep.c | 88 +++++++++++++++++++-- gdb/nat/aarch64-scalable-linux-sigcontext.h | 5 +- 2 files changed, 84 insertions(+), 9 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index bdd5cb05c10..f76d1888072 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -48,6 +48,7 @@ #include "linux-record.h" #include "arch/aarch64-mte-linux.h" +#include "arch/aarch64-scalable-linux.h" #include "arch-utils.h" #include "value.h" @@ -152,6 +153,7 @@ #define AARCH64_EXTRA_MAGIC 0x45585401 #define AARCH64_FPSIMD_MAGIC 0x46508001 #define AARCH64_SVE_MAGIC 0x53564501 +#define AARCH64_ZA_MAGIC 0x54366345 /* Defines for the extra_context that follows an AARCH64_EXTRA_MAGIC. */ #define AARCH64_EXTRA_DATAP_OFFSET 8 @@ -164,13 +166,23 @@ /* Defines for the sve structure that follows an AARCH64_SVE_MAGIC. */ #define AARCH64_SVE_CONTEXT_VL_OFFSET 8 +#define AARCH64_SVE_CONTEXT_FLAGS_OFFSET 10 #define AARCH64_SVE_CONTEXT_REGS_OFFSET 16 #define AARCH64_SVE_CONTEXT_P_REGS_OFFSET(vq) (32 * vq * 16) #define AARCH64_SVE_CONTEXT_FFR_OFFSET(vq) \ (AARCH64_SVE_CONTEXT_P_REGS_OFFSET (vq) + (16 * vq * 2)) #define AARCH64_SVE_CONTEXT_SIZE(vq) \ (AARCH64_SVE_CONTEXT_FFR_OFFSET (vq) + (vq * 2)) +/* Flag indicating the SVE Context describes streaming mode. */ +#define SVE_SIG_FLAG_SM 0x1 +/* SME constants. */ +#define AARCH64_SME_CONTEXT_SVL_OFFSET 8 +#define AARCH64_SME_CONTEXT_REGS_OFFSET 16 +#define AARCH64_SME_CONTEXT_ZA_SIZE(svq) \ + ((sve_vl_from_vq (svq) * sve_vl_from_vq (svq))) +#define AARCH64_SME_CONTEXT_SIZE(svq) \ + (AARCH64_SME_CONTEXT_REGS_OFFSET + AARCH64_SME_CONTEXT_ZA_SIZE (svq)) /* Read an aarch64_ctx, returning the magic value, and setting *SIZE to the size, or return 0 on error. */ @@ -324,7 +336,10 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, CORE_ADDR section_end = section + AARCH64_SIGCONTEXT_RESERVED_SIZE; CORE_ADDR fpsimd = 0; CORE_ADDR sve_regs = 0; + CORE_ADDR za_state = 0; + uint64_t svcr = 0; uint32_t size, magic; + size_t vq = 0, svq = 0; bool extra_found = false; int num_regs = gdbarch_num_regs (gdbarch); @@ -360,7 +375,7 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, /* Check if the section is followed by a full SVE dump, and set sve_regs if it is. */ gdb_byte buf[4]; - uint16_t vq; + uint16_t flags; if (!tdep->has_sve ()) break; @@ -373,9 +388,23 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, } vq = sve_vq_from_vl (extract_unsigned_integer (buf, 2, byte_order)); - if (vq != tdep->vq) - error (_("Invalid vector length in signal frame %d vs %s."), vq, - pulongest (tdep->vq)); + /* If SME is supported, also read the flags field. It may + indicate if this SVE context is for streaming mode (SSVE). */ + if (tdep->has_sme ()) + { + if (target_read_memory (section + + AARCH64_SVE_CONTEXT_FLAGS_OFFSET, + buf, 2) != 0) + { + section += size; + break; + } + flags = extract_unsigned_integer (buf, 2, byte_order); + + /* Is this SSVE data? If so, enable the SM bit in SVCR. */ + if (flags & SVE_SIG_FLAG_SM) + svcr |= SVCR_SM_BIT; + } if (size >= AARCH64_SVE_CONTEXT_SIZE (vq)) sve_regs = section + AARCH64_SVE_CONTEXT_REGS_OFFSET; @@ -384,6 +413,38 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, break; } + case AARCH64_ZA_MAGIC: + { + if (!tdep->has_sme ()) + { + section += size; + break; + } + + /* Check if the section is followed by a full ZA dump, and set + za_state if it is. */ + gdb_byte buf[2]; + + if (target_read_memory (section + AARCH64_SME_CONTEXT_SVL_OFFSET, + buf, 2) != 0) + { + section += size; + break; + } + svq = sve_vq_from_vl (extract_unsigned_integer (buf, 2, + byte_order)); + + if (size >= AARCH64_SME_CONTEXT_SIZE (svq)) + { + za_state = section + AARCH64_SME_CONTEXT_REGS_OFFSET; + /* We have ZA data. Enable the ZA bit in SVCR. */ + svcr |= SVCR_ZA_BIT; + } + + section += size; + break; + } + case AARCH64_EXTRA_MAGIC: { /* Extra is always the last valid section in reserved and points to @@ -422,7 +483,7 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, for (int i = 0; i < 32; i++) { - offset = sve_regs + (i * tdep->vq * 16); + offset = sve_regs + (i * vq * 16); trad_frame_set_reg_addr (this_cache, AARCH64_SVE_Z0_REGNUM + i, offset); trad_frame_set_reg_addr (this_cache, @@ -440,12 +501,12 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, offset); } - offset = sve_regs + AARCH64_SVE_CONTEXT_P_REGS_OFFSET (tdep->vq); + offset = sve_regs + AARCH64_SVE_CONTEXT_P_REGS_OFFSET (vq); for (int i = 0; i < 16; i++) trad_frame_set_reg_addr (this_cache, AARCH64_SVE_P0_REGNUM + i, - offset + (i * tdep->vq * 2)); + offset + (i * vq * 2)); - offset = sve_regs + AARCH64_SVE_CONTEXT_FFR_OFFSET (tdep->vq); + offset = sve_regs + AARCH64_SVE_CONTEXT_FFR_OFFSET (vq); trad_frame_set_reg_addr (this_cache, AARCH64_SVE_FFR_REGNUM, offset); } @@ -461,6 +522,17 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, aarch64_linux_restore_vregs (gdbarch, this_cache, fpsimd); } + if (za_state != 0) + { + /* Restore the ZA state. */ + trad_frame_set_reg_addr (this_cache, tdep->sme_za_regnum, + za_state); + } + + /* If SME is supported, set SVCR as well. */ + if (tdep->has_sme ()) + trad_frame_set_reg_value (this_cache, tdep->sme_svcr_regnum, svcr); + trad_frame_set_id (this_cache, frame_id_build (sp, func)); } diff --git a/gdb/nat/aarch64-scalable-linux-sigcontext.h b/gdb/nat/aarch64-scalable-linux-sigcontext.h index 74407bd266a..18623443744 100644 --- a/gdb/nat/aarch64-scalable-linux-sigcontext.h +++ b/gdb/nat/aarch64-scalable-linux-sigcontext.h @@ -30,7 +30,10 @@ struct sve_context { struct _aarch64_ctx head; __u16 vl; - __u16 __reserved[3]; + /* Holds flags. This field was defined for SME support. Prior to it, + this used to be a reserved 16-bit value. */ + __u16 flags; + __u16 __reserved[2]; }; /* -- 2.25.1