From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2053.outbound.protection.outlook.com [40.107.13.53]) by sourceware.org (Postfix) with ESMTPS id A7D243871020 for ; Fri, 30 Jun 2023 13:46:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7D243871020 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=l3sTrWt3zt4R2K1XxJ4chAwQCbni0Ko2G1UmubF2PYk=; b=ktLPzi+cF5tUf19qKJ2L3JxM0bQtq+U3jBHopr0B2R/n97/A4Jw7z3bVkGsLAO840btrNe1EuS/LeGiey5sewjrEXLw2/RduohWjPst69YWv4wUujFqjHDxcWYMYqiwRqubMAzXmrWyEqs+btIJuSMSRQK6WEfJqnK/98Dib7l0= Received: from DB7PR05CA0034.eurprd05.prod.outlook.com (2603:10a6:10:36::47) by PAWPR08MB9053.eurprd08.prod.outlook.com (2603:10a6:102:341::19) 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:46:44 +0000 Received: from DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:36:cafe::56) by DB7PR05CA0034.outlook.office365.com (2603:10a6:10:36::47) 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:46:44 +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 DBAEUR03FT054.mail.protection.outlook.com (100.127.142.218) 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:46:44 +0000 Received: ("Tessian outbound 52217515e112:v142"); Fri, 30 Jun 2023 13:46:44 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4d71d0b3371bccfb X-CR-MTA-TID: 64aa7808 Received: from 218406546840.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2E0F90BA-00F6-4EE8-A00C-2FF57C18DF11.1; Fri, 30 Jun 2023 13:46:37 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 218406546840.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 30 Jun 2023 13:46:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N5LkGi+im6kizTSOtNrHGADZzuAVda90g7s2L7zMmLHCOpzvLdjk18XlNnx0Q8mwFVIIoJF/l26rs6sBWXnG40xbbTiVYwc65rTu1H3xQIxERpRbg33YoCDVEMG9wKoS1mdpDdgeAWjevjDgLLnsX2ltuLof6j8llXprDprlXGsq4Tp7i+oompGqtCHdhIXWdoNON/LjDkK3EUZOeUHaSHbMxlouIgiKn70xp1NpS8oqqFeYFDw+QAA95a0c/prlcsvq1t3kx11oYsRR4c8EtE23VjCC19yKUVk+QYDO8MBLWPZ+UHuX7K8Pv698ce59Iz4Mh1MSUh0QGnvH5wweEQ== 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=l3sTrWt3zt4R2K1XxJ4chAwQCbni0Ko2G1UmubF2PYk=; b=YjQYQz7WfDH1fVKtDcW8YmDhlI/jwBgrJdf9xzMu4VqTkogn1/ejweKgJKlF/curwRjXIjKhEGIAZWS6mydgRIFPLk7tUy0399Mnoli8+00LvUwyqFoBYXuMojdpBLOKBtQvdCC/ed8AiIt3g/5+6w2zd97ydbWcVVoTMVwp3W1ls5EITHgkvg3sZN6/9ZpukiylR1OM0XUpypX3BlDZ9aDeTNDDDYL2ZKt9+2gbGJ/oEf1jhmv+0huC3Bikhf3hKaBccIGPvDFXAZ+sLqkEB3cj0hDqMfSzdNrsTdRU1yhpb0y5qKCRMQuzOevGcTv2bixjtZc+QDYy7BN6B2dpFQ== 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=l3sTrWt3zt4R2K1XxJ4chAwQCbni0Ko2G1UmubF2PYk=; b=ktLPzi+cF5tUf19qKJ2L3JxM0bQtq+U3jBHopr0B2R/n97/A4Jw7z3bVkGsLAO840btrNe1EuS/LeGiey5sewjrEXLw2/RduohWjPst69YWv4wUujFqjHDxcWYMYqiwRqubMAzXmrWyEqs+btIJuSMSRQK6WEfJqnK/98Dib7l0= Received: from AS9PR04CA0123.eurprd04.prod.outlook.com (2603:10a6:20b:531::20) by AS8PR08MB6517.eurprd08.prod.outlook.com (2603:10a6:20b:31b::8) 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:46:34 +0000 Received: from AM7EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:531:cafe::10) by AS9PR04CA0123.outlook.office365.com (2603:10a6:20b:531::20) 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:46:34 +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 AM7EUR03FT014.mail.protection.outlook.com (100.127.140.163) 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:46:34 +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:46:33 +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:46:33 +0000 From: Luis Machado To: Subject: [PATCH v3 08/16] [gdb/aarch64] sve: Fix signal frame z/v register restore Date: Fri, 30 Jun 2023 14:46:08 +0100 Message-ID: <20230630134616.1238105-9-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230630134616.1238105-1-luis.machado@arm.com> References: <20230630134616.1238105-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT014:EE_|AS8PR08MB6517:EE_|DBAEUR03FT054:EE_|PAWPR08MB9053:EE_ X-MS-Office365-Filtering-Correlation-Id: b06684f5-4e7c-4e87-4815-08db79707125 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: Q9iGk/s6Eql59IjDQQ4k9C6bZPcPB/nynM0EsLvKWPH5Q03mDC50TF7tqXhPnSSMLtzv5tnSTXDCfq+fgs8PmWaQZOUuj9V8kdlOXNZfXtyq0qtln+nQm13DHL158dkW7pl/mo/wlpx5+ek+f4ddXx2rMd6hDchz+cqwPyX2M7EeGA4Qnhc7kOxKRRwuogqC8qVPfaAgl1OSciQbu6jUjFlG1ZMN4tVAyQSZIBxLZw5dGIMIQsamSsCogjGHumi0h197qUF9N1LdYNgJ8sxst4au0GL8mTecujvEpiud+2lSfCXPPau6sBY6e3nYOrOHMizjxCT5dlpNaqvBcVPWJZIZmZGVYpIIAAbDoiYz4jnu7p3wjYeUHRh/1SqEjZ0QwD4WBGi1LnzXmQrqK6i8fyUR1CXrm9u3QyflLU1kHx3Ru8y+VW01sHgbpnF449U9Z3Y4eSnXXpkVo9F8dHKvshcItMOoXNpeULWCdpyRKkJ664nTODAQ+p7PNlbHvW17TW2mTph1GTwenuRCMQAJE+mA8rU+nY2q7lOaFLXgmhL3rsEQYykTZ547GXA7bwew8YQ0cXjZ2b3qwgMmowYP7tEzcbhjJw0xijNgJAcir/qwjp2BEjsqgwh9Utbhqd+33vwPFp85emV/P6ShJRL1F+27IoBV8mjOQxqChkVIgNQKzcsA1Q6H6tiEIxH91uiUe1AndfQR/lmkbUmcO7JhT/oVt33NzZ4Dy9Jdqkq2qsLvlTxVO4fU5q0HEPnIYdq4bW/1MgUprurg1bZQ8AJYlA== 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)(396003)(136003)(346002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(41300700001)(316002)(47076005)(83380400001)(82310400005)(86362001)(336012)(36860700001)(426003)(186003)(26005)(1076003)(44832011)(2616005)(2906002)(82740400003)(356005)(81166007)(40480700001)(5660300002)(36756003)(8676002)(8936002)(70586007)(7696005)(478600001)(6916009)(70206006)(6666004)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6517 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ee13eaf7-17af-46da-0a21-08db79706b42 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8CsIpsFuLah0Xyh+/kZBRxD3rxxLUGUgti24mh4Z5VSTUTjACrlC1SBTLi2x3tXi57J5FYcnFV7NglKWv+RcZv1NI+ffcoRl41kHq61FBcPwBJgEloLNqgoDxbddxKHuVeXkjEMG7ZGH0Ev9oRJfnwh2Ft0Zu7SHKmD2sun7KYL2yldxy3sMRfxn9vnv/olwvFtNTsPHrfEl2VmVi5ohZugI1TrZiuTZGuY45O4rx0kOAZDFXKhFbxZzW3hLBwDh7wp/49O8W+1puMNprkmdFuJtkUXfGCsiNjws9ftGOJzk9UXObZJVmAii5yZaf7/A92QTrndkNzr+T1QhL3lftOBJ4dqleHCiMBYDaYVkXIiFNwFfifqWetB733oapIukXrCXpWsHSrwZVlXuLq9Q8dvpv3+hrEZx9ASmxZU1yHRYl2H6FpRdpiJ9GR1SPGS7FQCYktbq61UWF9GbdIMYz37b9SojBGVrBQ/NoT5PHsgRnBsoE2dqeVZTZqLYzv0DYZOHGzCw4ZBEUraZoFITaxR8E/92+Z50Cfv4YksAZEN4MGOreksqQlKpgdqtBeqzT16f85g9MX+NQV/gtYfOMNmBergB42JCDNN/UrtIjieo1OL4Ul3jY0KdcdJhvFYmTEk/9mpnRv79daFpdsJJLjkVh7TKKCHyKQ3xcePdpJUNwLRp0hLo5tkjDeIz8j94BuMpzlkPZAd5//+iohwOWwQdQy8hdgi/eL2B3OuLOpYUxlh4Vf/9Vr6tBuuDX3Um 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)(39860400002)(376002)(346002)(396003)(451199021)(36840700001)(46966006)(40470700004)(186003)(6666004)(8676002)(8936002)(44832011)(478600001)(26005)(70586007)(70206006)(6916009)(1076003)(316002)(86362001)(7696005)(5660300002)(81166007)(82740400003)(40460700003)(2906002)(2616005)(82310400005)(40480700001)(47076005)(336012)(426003)(83380400001)(36756003)(36860700001)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 13:46:44.4623 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b06684f5-4e7c-4e87-4815-08db79707125 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: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9053 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: While doing some SME work, I ran into the situation where the Z register contents restored from a signal frame are incorrect if the signal frame only contains fpsimd state and no sve state. This happens because we only restore the v register values in that case, and don't do anything for the z registers. Fix this by initializing the z registers to 0 and then copying over the overlapping part of the v registers to the z registers. While at it, refactor the code a bit to simplify it and make it smaller. Regression-tested on aarch64-linux Ubuntu 22.04/20.04. --- gdb/aarch64-linux-tdep.c | 108 +++++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 45 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index b183a3c9a38..eecf5bf13bd 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -196,14 +196,13 @@ read_aarch64_ctx (CORE_ADDR ctx_addr, enum bfd_endian byte_order, /* Given CACHE, use the trad_frame* functions to restore the FPSIMD registers from a signal frame. - VREG_NUM is the number of the V register being restored, OFFSET is the - address containing the register value, BYTE_ORDER is the endianness and - HAS_SVE tells us if we have a valid SVE context or not. */ + FPSIMD_CONTEXT is the address of the signal frame context containing FPSIMD + data. */ static void -aarch64_linux_restore_vreg (struct trad_frame_cache *cache, int num_regs, - int vreg_num, CORE_ADDR offset, - enum bfd_endian byte_order, bool has_sve) +aarch64_linux_restore_vregs (struct gdbarch *gdbarch, + struct trad_frame_cache *cache, + CORE_ADDR fpsimd_context) { /* WARNING: SIMD state is laid out in memory in target-endian format. @@ -215,11 +214,22 @@ aarch64_linux_restore_vreg (struct trad_frame_cache *cache, int num_regs, 2 - If the target is little endian, then SIMD state is little endian, so no byteswap is needed. */ - if (byte_order == BFD_ENDIAN_BIG) + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int num_regs = gdbarch_num_regs (gdbarch); + aarch64_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + for (int i = 0; i < 32; i++) { + CORE_ADDR offset = (fpsimd_context + AARCH64_FPSIMD_V0_OFFSET + + (i * AARCH64_FPSIMD_VREG_SIZE)); + gdb_byte buf[V_REGISTER_SIZE]; - if (target_read_memory (offset, buf, V_REGISTER_SIZE) != 0) + /* Read the contents of the V register. */ + if (target_read_memory (offset, buf, V_REGISTER_SIZE)) + error (_("Failed to read fpsimd register from signal context.")); + + if (byte_order == BFD_ENDIAN_BIG) { size_t size = V_REGISTER_SIZE/2; @@ -234,50 +244,67 @@ aarch64_linux_restore_vreg (struct trad_frame_cache *cache, int num_regs, store_unsigned_integer (buf + size , size, BFD_ENDIAN_LITTLE, u64); /* Now we can store the correct bytes for the V register. */ - trad_frame_set_reg_value_bytes (cache, AARCH64_V0_REGNUM + vreg_num, + trad_frame_set_reg_value_bytes (cache, AARCH64_V0_REGNUM + i, {buf, V_REGISTER_SIZE}); trad_frame_set_reg_value_bytes (cache, num_regs + AARCH64_Q0_REGNUM - + vreg_num, {buf, Q_REGISTER_SIZE}); + + i, {buf, Q_REGISTER_SIZE}); trad_frame_set_reg_value_bytes (cache, num_regs + AARCH64_D0_REGNUM - + vreg_num, {buf, D_REGISTER_SIZE}); + + i, {buf, D_REGISTER_SIZE}); trad_frame_set_reg_value_bytes (cache, num_regs + AARCH64_S0_REGNUM - + vreg_num, {buf, S_REGISTER_SIZE}); + + i, {buf, S_REGISTER_SIZE}); trad_frame_set_reg_value_bytes (cache, num_regs + AARCH64_H0_REGNUM - + vreg_num, {buf, H_REGISTER_SIZE}); + + i, {buf, H_REGISTER_SIZE}); trad_frame_set_reg_value_bytes (cache, num_regs + AARCH64_B0_REGNUM - + vreg_num, {buf, B_REGISTER_SIZE}); + + i, {buf, B_REGISTER_SIZE}); - if (has_sve) + if (tdep->has_sve ()) trad_frame_set_reg_value_bytes (cache, num_regs + AARCH64_SVE_V0_REGNUM - + vreg_num, {buf, V_REGISTER_SIZE}); + + i, {buf, V_REGISTER_SIZE}); } - return; - } + else + { + /* Little endian, just point at the address containing the register + value. */ + trad_frame_set_reg_addr (cache, AARCH64_V0_REGNUM + i, offset); + trad_frame_set_reg_addr (cache, num_regs + AARCH64_Q0_REGNUM + i, + offset); + trad_frame_set_reg_addr (cache, num_regs + AARCH64_D0_REGNUM + i, + offset); + trad_frame_set_reg_addr (cache, num_regs + AARCH64_S0_REGNUM + i, + offset); + trad_frame_set_reg_addr (cache, num_regs + AARCH64_H0_REGNUM + i, + offset); + trad_frame_set_reg_addr (cache, num_regs + AARCH64_B0_REGNUM + i, + offset); - /* Little endian, just point at the address containing the register - value. */ - trad_frame_set_reg_addr (cache, AARCH64_V0_REGNUM + vreg_num, offset); - trad_frame_set_reg_addr (cache, num_regs + AARCH64_Q0_REGNUM + vreg_num, - offset); - trad_frame_set_reg_addr (cache, num_regs + AARCH64_D0_REGNUM + vreg_num, - offset); - trad_frame_set_reg_addr (cache, num_regs + AARCH64_S0_REGNUM + vreg_num, - offset); - trad_frame_set_reg_addr (cache, num_regs + AARCH64_H0_REGNUM + vreg_num, - offset); - trad_frame_set_reg_addr (cache, num_regs + AARCH64_B0_REGNUM + vreg_num, - offset); - - if (has_sve) - trad_frame_set_reg_addr (cache, num_regs + AARCH64_SVE_V0_REGNUM - + vreg_num, offset); + if (tdep->has_sve ()) + trad_frame_set_reg_addr (cache, num_regs + AARCH64_SVE_V0_REGNUM + + i, offset); + } + if (tdep->has_sve ()) + { + /* If SVE is supported for this target, zero out the Z + registers then copy the first 16 bytes of each of the V + registers to the associated Z register. Otherwise the Z + registers will contain uninitialized data. */ + std::vector z_buffer (tdep->vq * 16); + + /* We have already handled the endianness swap above, so we don't need + to worry about it here. */ + memcpy (z_buffer.data (), buf, V_REGISTER_SIZE); + trad_frame_set_reg_value_bytes (cache, + AARCH64_SVE_Z0_REGNUM + i, + {z_buffer.data (), + z_buffer.size ()}); + } + } } /* Implement the "init" method of struct tramp_frame. */ @@ -432,16 +459,7 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, /* If there was no SVE section then set up the V registers. */ if (sve_regs == 0) - { - for (int i = 0; i < 32; i++) - { - CORE_ADDR offset = (fpsimd + AARCH64_FPSIMD_V0_OFFSET - + (i * AARCH64_FPSIMD_VREG_SIZE)); - - aarch64_linux_restore_vreg (this_cache, num_regs, i, offset, - byte_order, tdep->has_sve ()); - } - } + aarch64_linux_restore_vregs (gdbarch, this_cache, fpsimd); } trad_frame_set_id (this_cache, frame_id_build (sp, func)); -- 2.25.1