From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2056.outbound.protection.outlook.com [40.107.247.56]) by sourceware.org (Postfix) with ESMTPS id 9FF113856DDA for ; Fri, 19 May 2023 10:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FF113856DDA 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=ct9tZXQlqSyO8ZqFdXRtXIKSM1rhuC2DUeMTiJLar6U=; b=9iDk4lFNQXkZAFyB6vYiiRrZ09FIOWgC9xeFUUeqHoPbh//KGFOO0liiJ3WvaE2nHL/4rc4PvSyyPsSgNiRemwNHKHReostd6G6IHgK+XxnTTObiowBdj5chBrNg4IO48jPbHkllThIlFfRd+HtpzkfbN35K3Jk2Yvqfso6MvfU= Received: from AS9PR05CA0173.eurprd05.prod.outlook.com (2603:10a6:20b:496::7) by DB9PR08MB6377.eurprd08.prod.outlook.com (2603:10a6:10:259::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 10:25:30 +0000 Received: from AM7EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:496:cafe::2d) by AS9PR05CA0173.outlook.office365.com (2603:10a6:20b:496::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 10:25:30 +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 AM7EUR03FT018.mail.protection.outlook.com (100.127.140.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 10:25:30 +0000 Received: ("Tessian outbound 3570909035da:v136"); Fri, 19 May 2023 10:25:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7439f134b79187bb X-CR-MTA-TID: 64aa7808 Received: from 056401805b9d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2A38C693-3D99-4D22-9C17-41D31E8D7339.1; Fri, 19 May 2023 10:25:23 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 056401805b9d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 May 2023 10:25:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVO8SwQcQAD5r91N76E/Kk2XughWRoV3JMbqUha31Zn/JbFO775ATanigF/0Yej3/v7Um+rJILSHdKJ+xmSa4niGN/QyFryb1gLBNjYK5AiE3o3QPlWpWzRa9vAOeJ0xGy8EoIpB919WeiG3PqW72dcTD3KT8iLEZjnfvy9bglFyo7/nNmHZ3HvCeX60ficCs/Mx7cqkTNID2yR1OCEmvpVi34C4hyagRSbJTCMpT6+iaBq0w7vvSG3JI2ZB47IytV9QHAuH305CvwsFP3ne4FtKHOk+Yzr6Gw2NnjLJlXclNsF2izoejh26P0SpX+p9MHprvBRhWcT6fCVhbcIkGQ== 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=ct9tZXQlqSyO8ZqFdXRtXIKSM1rhuC2DUeMTiJLar6U=; b=efVp+EHhJuWNk+iOqRd+PsDtvwTBRm75tPTP0HeMzZB4PdfmmstSzy0q1UPWe0uHdKl5sEMAEWl1DbDWz5zk7jjdMhWhPUp0fjBcQytpvVvf7gwUU9Yn1zygxyJJyYEo09D/nH3D7DNL+/bg6xnROpyGj7qz6gy3PGjkWMy/MxtkHFxmkpekL4gW4Kriw9r0ZObbl+YUQViYWn/ouDdKLqUSYWvdpCJ/H6ebHlFN/WlRFsuaSOKeSEcxSv4NTqIrxXAO7sLgDUCW+FDl/Z3dGqHYJkJddqfbXo8NCUQ82YbbdkYolmGJiQxTSjXRirKrlqCaNFeL4g1eKI9Xo/PGLA== 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=ct9tZXQlqSyO8ZqFdXRtXIKSM1rhuC2DUeMTiJLar6U=; b=9iDk4lFNQXkZAFyB6vYiiRrZ09FIOWgC9xeFUUeqHoPbh//KGFOO0liiJ3WvaE2nHL/4rc4PvSyyPsSgNiRemwNHKHReostd6G6IHgK+XxnTTObiowBdj5chBrNg4IO48jPbHkllThIlFfRd+HtpzkfbN35K3Jk2Yvqfso6MvfU= Received: from DB6PR0202CA0002.eurprd02.prod.outlook.com (2603:10a6:4:29::12) by DU0PR08MB8615.eurprd08.prod.outlook.com (2603:10a6:10:401::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Fri, 19 May 2023 10:25:20 +0000 Received: from DBAEUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:29:cafe::d0) by DB6PR0202CA0002.outlook.office365.com (2603:10a6:4:29::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 10:25:20 +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 DBAEUR03FT057.mail.protection.outlook.com (100.127.142.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.7 via Frontend Transport; Fri, 19 May 2023 10:25:20 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 19 May 2023 10:25:12 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 19 May 2023 10:25:12 +0000 Received: from e129171.cambridge.arm.com (10.1.37.65) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 19 May 2023 10:25:12 +0000 From: Luis Machado To: Subject: [PATCH v2 09/17] [gdb/aarch64] sme: Signal frame support Date: Fri, 19 May 2023 11:25:00 +0100 Message-ID: <20230519102508.14020-10-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230519102508.14020-1-luis.machado@arm.com> References: <20230519102508.14020-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT057:EE_|DU0PR08MB8615:EE_|AM7EUR03FT018:EE_|DB9PR08MB6377:EE_ X-MS-Office365-Filtering-Correlation-Id: 214cc852-0c42-473f-ba3b-08db58535f3c 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: cxlzt32MrHEeLwit8wsxgSskyivmzYNQMbLWiei6it6NUzyEVqwfGaA+9LjSC3ueuEXn+IL8ZryBRKxQNRpcnZkJTTz6wj777G+F2Gtt+BY9lQ6oDzLVzGPFnyGeOGxzyoK/XM+LZobA6Nr3wSP6IQ3J8bK4jFgon4jvHJGz+VpWrL4pjMHYUK4caBWY6oEFcEmG57e3RzZxyOoqSaZpfEJBQzi6Vu/rUDrHonzsntWogBoZlnFlw8k/DlkXvhAZ1XBZGXTXYTSJVDT6KT+1NFowx/+CVIUXiK9UC4BnhaeI+WZoaW20vbAVKonEd9f0sSXdRepW/CTQ0+OjHgE+ygNs3l98OUvqiwaXIwE1iFegdIL5qk9eHrShBuvEi4MgGN9r47bEtRgVRvyy6I3kwRdZFJRQxWfpD2e0MpypR9EToBtFXhYM1Tv7bPtCbBmEgMjr1LoC1Xy7y3ODaDYflohocrlAwSqisHRTCCmk11FQrTMUBgRq/6i+CqSrGslPLyjXEhWLyEukJOeCcezFUlIYI0OUr++JroIGCc2e+MuHghbF/4GeWZgo4lYck8ORF0r0dMfR/ElYCn+4x2SLYBdu9QOKxvbbCpsYrGU24HpjaaUQEkrDZ52caIrJZfb/FZAp/la5K5IWneT/HDeyk9qx6TyjlVXddHyoS2fHlvTl5siKEp7ZYVW2bmWLYmgBAdUVAMYcKb9p7Fz1+iK8mADLFAoPm+jmQvzRY6vB1+kNWhRFET4v4E+BPAKlN/qBZ2bZTQxOjgJOow47iZyv8g== 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)(396003)(39860400002)(376002)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(36860700001)(426003)(47076005)(186003)(1076003)(336012)(6666004)(478600001)(44832011)(2616005)(26005)(83380400001)(2906002)(8676002)(5660300002)(36756003)(6916009)(8936002)(82740400003)(81166007)(356005)(40460700003)(41300700001)(70206006)(70586007)(82310400005)(40480700001)(316002)(86362001)(7696005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8615 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ff9afe99-4b9b-4be8-1d34-08db5853590e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rb5Ne4UAtPk8rjtrPf2AuJgbWv8dUtSmKZAiz7Jzz+IE9y3wJfk5cpC28ZbID3zuM6204disax3L3raRuk2/zm12Hms8S+cTOznDYlei760Nwoc2+hD18eH2I78XCsPbV2X4ohNfo4DH8fOWEKtPoytVV5yB56g7lctgpS60TQ2ddW+gCBInCFK/nvRk5DnNtxwg6oNwqpwy0pa8Pg9rHvlM9mk5+3nHIusURbbQDGEUxMHrfSaJ12osc8uikRstV+3ltAWjdOaFSGOULQszNd/CdhyVh6oY9ZakRuca2cr+lyGuhFYANtLnmB+zGXqUQLxyUKHJD12bWMiAbVHjH7KaYar/VjBq0DKyw3Tw29+D0vCP7p1qM2XflXCS2w6XdFJmru2l8b/f+EzNh2DPK3nv8b8WYd0szNcdjOApKwBw6cp/W3IMFGN0QSQAm8QmwARHi7uldR7b3wWH8zldwqkTUcJzu0nygtRxpPz/yLUhe7NktDlyglrTKxOZr2FYVcPaebIfCaQh6WKPfpvgTNmXUpMvMk2OAw0WVl1q4dlgSCOlsSQpE2J2PMefxYWCY8Vz1wq+X6MtGwLaWhP72VsbRDKiia5yYDSQ1ePQdV9gxnB3qLFn5wbu76kx+ainwCew8a3LRM1mjWc1wp4vuEPwTe4gaWOrSE27MgNICx9beXp/qfuY10IUitHcMeRqDdrj8JogxDWC1kpsfPXKguoze6vwFrbretaAs7VP/fH0k/UYMozbNgK5FxwlZm+d 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)(376002)(396003)(39860400002)(346002)(451199021)(46966006)(40470700004)(36840700001)(478600001)(316002)(5660300002)(44832011)(8936002)(8676002)(41300700001)(6916009)(2906002)(40460700003)(70206006)(70586007)(36860700001)(36756003)(40480700001)(6666004)(7696005)(1076003)(186003)(26005)(82740400003)(86362001)(47076005)(2616005)(81166007)(336012)(82310400005)(426003)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 10:25:30.5621 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 214cc852-0c42-473f-ba3b-08db58535f3c 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: AM7EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6377 X-Spam-Status: No, score=-11.9 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: 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 eecf5bf13bd..1e12a8f0279 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. */ @@ -325,7 +337,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); @@ -361,7 +376,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; @@ -374,9 +389,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; @@ -385,6 +414,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_SVE_CONTEXT_VL_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 @@ -423,7 +484,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, @@ -441,12 +502,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); } @@ -462,6 +523,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