From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2048.outbound.protection.outlook.com [40.107.20.48]) by sourceware.org (Postfix) with ESMTPS id 602F83858C66 for ; Thu, 7 Sep 2023 15:20:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 602F83858C66 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=DuFtE83+v9j041Tg1zCC3Q2ZPI7f7GtX2cpdEDBUrj0pQLG6KEEFavOXdDssCwRAflnT0lvj0ykGyFuqVBc89O5o9iFyth8wuf2W5kfnTrQVVMEZq05vCeFbhJkXalTbE8vymDoJ/3KI2NUmMbDywA2xbd/60sEISPFDi3kiSd0= Received: from AS8P189CA0042.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:458::12) by AM9PR08MB6018.eurprd08.prod.outlook.com (2603:10a6:20b:2df::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Thu, 7 Sep 2023 15:20:32 +0000 Received: from AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:458:cafe::bf) by AS8P189CA0042.outlook.office365.com (2603:10a6:20b:458::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Thu, 7 Sep 2023 15:20:32 +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 AM7EUR03FT034.mail.protection.outlook.com (100.127.140.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.28 via Frontend Transport; Thu, 7 Sep 2023 15:20:32 +0000 Received: ("Tessian outbound 169aaa6bf2b7:v175"); Thu, 07 Sep 2023 15:20:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: da325d220a35de2f X-CR-MTA-TID: 64aa7808 Received: from cc5880917565.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FD363C8E-13F9-47E4-8A99-F1679AEE657A.1; Thu, 07 Sep 2023 15:20:25 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cc5880917565.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Sep 2023 15:20:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bvEfsw9NRx/v1VFg92B3f048AIJ88sajvlQbtVzWQ9En2jeK1ufveHal5iU01ihDT8sAQveGbNDNgqxiXU19qJT0XDw4m6quXLzqQpNrTUHpziHHY9H+yj6lm1wkAGw0jLv6xhvkRzerh9rahcLoAc7zBPp1G/WZhnsu+DmWTlgibv32kyWlqSjvKbA876hh96zg9LgF3LlZ60SYZFkzck8j5+iRGYG1aY2N/O1Ax05K0y0ScSpfVDDRUTs82y3ID9+Cm70yxyR5lo7qbp5Ju7Fl8Spe65TyOV4GabwHkcTt3QDaDU/x2RJcd7y55OFdHuTp8DQBUOQIdWUmAwinkQ== 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=bOhSUtgGk1Ecl99MDL4HrDkEzd/K7A4KCwIgjNby6Pd+chn0QTLxq3Af0febmPGU5c/IhKJTM2Fr6/kAwFj1uVRf27bgbhgJ19K/DtDU625TyLVhhschGbPufumrLG4/faKzDcjQ71TVFSXcohnoRAMezrDoZHk581vFrdFcn/3/9xs22+RNIXJDVbxn3Uc3fzWy4naTs6VWis3C88sNVuiTva8jhwnMN42Nkx7KdUXmBmJcx+DTwJsEwA7f4EE4Iy0nO7ez1i9iQZzgB2C2N68KhzN8HMCO+xupscJbS6aheY0EpJVAysJ3FyOytHPKk5sIh2Z/S1G98Bu/dL2+SA== 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=DuFtE83+v9j041Tg1zCC3Q2ZPI7f7GtX2cpdEDBUrj0pQLG6KEEFavOXdDssCwRAflnT0lvj0ykGyFuqVBc89O5o9iFyth8wuf2W5kfnTrQVVMEZq05vCeFbhJkXalTbE8vymDoJ/3KI2NUmMbDywA2xbd/60sEISPFDi3kiSd0= Received: from AM6P191CA0069.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::46) by AS2PR08MB9247.eurprd08.prod.outlook.com (2603:10a6:20b:59d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Thu, 7 Sep 2023 15:20:23 +0000 Received: from AM7EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:7f:cafe::61) by AM6P191CA0069.outlook.office365.com (2603:10a6:209:7f::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Thu, 7 Sep 2023 15:20:23 +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 AM7EUR03FT054.mail.protection.outlook.com (100.127.140.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6768.28 via Frontend Transport; Thu, 7 Sep 2023 15:20:23 +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; Thu, 7 Sep 2023 15:20:22 +0000 Received: from e129171.cambridge.arm.com (10.1.32.59) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Thu, 7 Sep 2023 15:20:22 +0000 From: Luis Machado To: CC: Subject: [PATCH v5 09/16] [gdb/aarch64] sme: Signal frame support Date: Thu, 7 Sep 2023 16:20:11 +0100 Message-ID: <20230907152018.1031257-10-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230907152018.1031257-1-luis.machado@arm.com> References: <20230907152018.1031257-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT054:EE_|AS2PR08MB9247:EE_|AM7EUR03FT034:EE_|AM9PR08MB6018:EE_ X-MS-Office365-Filtering-Correlation-Id: 2bd34cc2-3d67-49e3-c082-08dbafb5fa62 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: ntKvNYV+7gcKSgQLuUCYfCKd+HQBpVp65KvQQgiCUgXwmTwdmGs7/FNIBFejfOXOZUMxreIlfGrLuNjnsLEVjziiPofPaO3ZjQnJf10kOBf3qmW+TPGByKFyYB3IJgckWxDrp/nwPiaXwi7c8hI0fn5Tq8/ChhNvc2wTionbKBFvlYHIj63qgDoO/NUZj1k4cq7GyNZFgXDhR7aUdVtJ0TOcQi05iY1LhOG8XXjIGlOwgwbfPdCFidSaZF9bjsINyMcqsxCoysn6xpjTdsQSG1ZZ7JoINqdIY91sP2flNgg9HRg7y8C+zfW6kjTsXhQDYdNyhxcLhGyNlJ6HbZtl2+vttyjrBu0cIBjmrr6MvHCKvFfCrMtfyw8l77PCc50gZIahaIgrDSqGH9Bo9BbEV41DLrLaKQYR+xW4zteBTx6sB4Xr5sWwK2rNXrVqJntn21TONyutJ50xpIqbEC3P6vSUxv4ka7BYH2UWxm8fgJeJgkcJnt/Zu0Bf30irLmL7J5CfDSAZDG0+ONPklZ1j1BYR7fOfAY0k7KaYexHw9bA0RM5lzmX+2GzLc0L82sGmy0/WS/paSWKqnBREtPt1U+wQvdHJj18WgNZWIbIY6tQ+fSwk6nu0HkLIRUUskznFc/j3fa/1Ty6JxwE/ai2bUhbUK20ysc84p3YhSU9ztchhqMhEu/+9u108iE/EkegaNy34/oed4R7fQ2RAyt82spRd8dTiPbyDN0TkTgvaBSAo86olWG2B0l+wUX1oQul2uzUYbTaxSDEkYcz9Nvm3Sw== 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)(396003)(136003)(39860400002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(46966006)(36840700001)(81166007)(6666004)(7696005)(356005)(26005)(40460700003)(86362001)(36756003)(82740400003)(36860700001)(40480700001)(47076005)(1076003)(2616005)(2906002)(336012)(426003)(83380400001)(478600001)(70586007)(70206006)(8936002)(8676002)(5660300002)(4326008)(44832011)(6916009)(316002)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9247 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 90a58c4b-1596-479b-27be-08dbafb5f4bc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lIQ629okg3+iSOxs1JC6YR3KiHKSokartXo5OJ70/am27dyz7wwDzTj9q80Y1oUZKuHwN2FUpbCDz7AOUcD3Bb0nD7P8kIDzqKFc0x4cOJLihRVIxUkOnP26ULQZkYTQTG8xgYhKSYRAzG5v3R+dQmWzAx62/yeKlUNninCOxIXQBD1h4JRGQulC5u7VgRv9bGtwHbQ5e4JT7Izb1JPqzmMywsrnNftXI+AnuJTp0GydiUSj5Z1mG0VNf1Mfqjdr5+vgEKlBsoNcZPnAXzxFq1ow9pFrgvtrnRf74G3nTMlbZioGRsoi3S+kHZE4qXB7eu9ACThJZnfTJhq0yTznZz2+DnegETigrtSNa41Z+Hw5NKukfde8ZfsmKdps7tjptju4fjiC34YJJ9gA8Je1sGAdlioeWPVDvTS1Y+6toY1sFumFyzMEDOiI9V8UQvrY25qQuDqBEX2MGNB1FLd/S76zira36T4VSN2OM34AW6WEjbVvFzyCCGxyDMZLL28GnUsMOlDDWicQ1yYwSVUsYKGo91p8OovFsqd61xP5juyo9yY8G7CQXky2f9+Qf9r/HcIY6/cBT644Eb0jW0BwR3EV8jQik3K50Y8+HHm9q6NlQ4VjM40548dsShUGqs+r5RcnieNE539F1i+UXk//c51R7T4TkydOkDb1Ntlm2N/Vx6KJl4M/6uUZR88WLo5h0jBcdHFjbSxGeU/1AP4L0VZ8aF1IoPJOl821XvF7wD3oREOmtE3dinDbqyT/B/3W 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)(396003)(376002)(346002)(39860400002)(186009)(1800799009)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(81166007)(478600001)(336012)(426003)(26005)(36756003)(47076005)(41300700001)(82740400003)(7696005)(1076003)(107886003)(2616005)(70586007)(6916009)(36860700001)(316002)(6666004)(83380400001)(70206006)(8676002)(44832011)(5660300002)(2906002)(4326008)(40460700003)(40480700001)(86362001)(8936002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2023 15:20:32.6993 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2bd34cc2-3d67-49e3-c082-08dbafb5fa62 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: AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6018 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