From patchwork Tue Apr 11 04:26:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 67599 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3AE353856DC0 for ; Tue, 11 Apr 2023 04:28:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AE353856DC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681187288; bh=l3sTrWt3zt4R2K1XxJ4chAwQCbni0Ko2G1UmubF2PYk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gwUP4OoLF3lQqGcaPcyG+YE/uAmcNUoHnzlk9IyImeEmVNnTl/CvQO7bqh0+J40LR FocYY1QuuyPMW65LOgVV+GN/ZsVmxAQd0qJ9EEOMe7p1aM0HYcJ580otOP/QofUr8R OVo5mTlxwreF6XWFNZanXsrAKoe67z+yCPMI/3LU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2041.outbound.protection.outlook.com [40.107.22.41]) by sourceware.org (Postfix) with ESMTPS id 4ACBE3858C20 for ; Tue, 11 Apr 2023 04:27:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4ACBE3858C20 Received: from AM5PR0301CA0006.eurprd03.prod.outlook.com (2603:10a6:206:14::19) by PAXPR08MB6703.eurprd08.prod.outlook.com (2603:10a6:102:138::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 04:27:15 +0000 Received: from AM7EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:14:cafe::94) by AM5PR0301CA0006.outlook.office365.com (2603:10a6:206:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36 via Frontend Transport; Tue, 11 Apr 2023 04:27:15 +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 AM7EUR03FT039.mail.protection.outlook.com (100.127.140.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.27 via Frontend Transport; Tue, 11 Apr 2023 04:27:14 +0000 Received: ("Tessian outbound 99a3040377ca:v136"); Tue, 11 Apr 2023 04:27:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9815e504b9445b7f X-CR-MTA-TID: 64aa7808 Received: from 565846579a3c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6AE08CEF-7B17-4D7D-AF4F-2A5388D5CFE7.1; Tue, 11 Apr 2023 04:27:08 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 565846579a3c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 11 Apr 2023 04:27:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BuOkcYr9r7+c+5QAfTuHJQ1Rnpi+GFkEbALnn03sEL/XrlBcolb75QzEPl+jRvMbetRMYEVOsfXWT9RUU9WpuYyol6rOhzJCOqv0eOoS2hFY7TVbiMHpLRvlSl1EXY8GhsWcZoynVdLtyvpXTtFPAfi0wgTf8amKQqTQX54hk+mWI9CVum+ytkZLJn8aPFBnJYM+ihl0hdHzOdz1ljetEoyLf3GLIq+/zZOCGFOTZBLhxSXiafY2B8VO+J/pvWDYo0qu4o4f1qa5NrNPeKRsQPzUdoFjaFbri+MqLUJMEUCR3ZjPLBrtnvcHtJKE2eFCFo+4/gyx5suGCJQdkyA4Wg== 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=KQ+T6CFXZh5ETn5JEkGszwF8tD+CvefXtQylnM6ijvPxsnHQImWCdGSDiVMsTV0Kpf8voXf4RnVQ6v5BojwClb5O0k9mnPCONblCRX4fbMJdo10IfVdBRbpNhraJ5QtKPR8io238PKXaRieHdIOSPBXfgNqbh93d4nSlQXn04OgMibZicJSPv2xy6Q1G2l4/0Tzkyu5pbnuIijlhCwUixC/bfd/L72F4cHyPHAOk1U5ECYzKBEdEGlz7Yao919ac0o/RZsp+44Eyp1Zp9dVJR/7qurRATJmDnUSbG5tNt4gUMdTdt/z6RhnfRRWBjgadrpPiiYPvYXhZm18wVMV/0A== 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 Received: from AM3PR05CA0124.eurprd05.prod.outlook.com (2603:10a6:207:2::26) by GV1PR08MB7347.eurprd08.prod.outlook.com (2603:10a6:150:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36; Tue, 11 Apr 2023 04:27:05 +0000 Received: from AM7EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:2:cafe::64) by AM3PR05CA0124.outlook.office365.com (2603:10a6:207:2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36 via Frontend Transport; Tue, 11 Apr 2023 04:27:05 +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 AM7EUR03FT053.mail.protection.outlook.com (100.127.140.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.25 via Frontend Transport; Tue, 11 Apr 2023 04:27:05 +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.17; Tue, 11 Apr 2023 04:27:04 +0000 Received: from e129171.arm.com (10.57.80.123) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Tue, 11 Apr 2023 04:27:04 +0000 To: Subject: [PATCH 08/17] [gdb/aarch64] sve: Fix signal frame z/v register restore Date: Tue, 11 Apr 2023 05:26:49 +0100 Message-ID: <20230411042658.1852730-9-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411042658.1852730-1-luis.machado@arm.com> References: <20230411042658.1852730-1-luis.machado@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT053:EE_|GV1PR08MB7347:EE_|AM7EUR03FT039:EE_|PAXPR08MB6703:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f20dc08-d457-404b-b103-08db3a450724 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: Th5lj/RIwId2jA233wBN9av7OvkBBFrHzM2qHtE/m8gTrBEhvXcJYU7VPD04FHBMsiAUxEOV41yrP7RyI+F5uwxduBYBLSfYFD7Y+R4oRa84W8cAj18UGg2q/KH5W2PmrxhUNwIIjYMZeBs6IDHQikDZNOSvFODUNhIKf6C9UxjOpaaD98LUWLyhqr4pcmoHgK1/YdixEptBdKHAGZ8RIGSRCxnb7b0oG54kuhn0TMmuzOBDBWR8hrjmrMjASREo2syb41Uch/DcIrZFWV4/M1GSNf1JMo3QjMtXU0opx9VnVKjPwRVqz8Duzs7b41aYNl3LJXm1XEFM8VTP/3rQFIQqpsqTtUah9W2yAQB12cbT39UgdyBF/Mo+SRyXKDx4dqMjPQFPAEXMD1wUvmjKRDWShBSjY0RfsOLIcfa8/c2R+gC73ZcMsAHdz9EASGrgdWbV+0aN1MFZkQH/KpWeyytbskj9sleyhstqZ3i0YpxkExKk5QxDa+qOdbLfePEHiE/fgaLRODekAu/itJaLDYSgk46rLGKhhMLOEbycWWeNFOxc8HEG3z3uWAv4TtgU7sZDtmjQ0OFf3wBu8YTUZNUPX9tAQqt2lPX9LRaqAdeJLaaYEKHW2nYh4X0YvOoitut2OjoKVWpuQ1K+kpGXrBJsY5YVq0nAUSEuNUwXKPjA1fAYg95s3Zdm8hYhNdB6lzekuNU5D//iF8sGWc+qjg== 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)(346002)(376002)(396003)(136003)(39860400002)(451199021)(36840700001)(46966006)(478600001)(7696005)(6666004)(26005)(316002)(1076003)(186003)(2906002)(44832011)(70206006)(70586007)(41300700001)(6916009)(8676002)(5660300002)(82310400005)(8936002)(356005)(81166007)(47076005)(86362001)(40480700001)(36756003)(83380400001)(82740400003)(2616005)(426003)(336012)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB7347 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ea792bde-3a06-4fcb-d461-08db3a45014d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3zYL+M14uoS5/zpUwahRkPPHXw+dlNs65ZW1krthFzLsZaUBqA78kw6mmy2JQ/2QAYUeT7+nMCwXaJnvVXolOSLOpeOaC8DoPiRGMW1/gxzLSa7wCwUNy0fA44e3p/AKi7cNqAZma9AkJjVYBIwg2ShSMp/BfIB+VI4zClPey6H0X8RzRnraYh4rmcoszoXKKVvjFbCKZ/I+stdd+bnLzy/8TGYAnOdBEYM7zMKwSJvHFtPFm5TmhmgG/8VrKq7FsbdluOxQvXwLYV+2r6o2Y6zVIAEQtclDBJN3MNKFO99hh1P9036Y3fmv9Yb3ZZ9dhFGZTgLdWPGzCxvWuag+VY6c2y+fyTN7NmRUsssBaAOcZgOLYlhO+Y++dQe6N9Y0IrBFa0vL6ravbh9ZxkUyQ54ZKqElJ0q9IiXqf7Q1IWEyjnrw/aubqFEADFkKBa4mRwgUK8nd95yi+6cU7ecod+VNbvqW09Bw4bdfDwIKEXy33xx8BeH3la6MiE8LgsYzYUcc3HJ6NX7wZk33/HANunn2RY0sDstz9ZIzM60luRh5qJ1Z4xrYb96hp/4d5Kb74+urTz/Nb3U6QRQp1qXha06Yrgz8WfP14tng7b3uS7Hp580cniKrhw5aTpzTelXYRfCn/Rx0vZ+k6ADLV4Zd69GHTX6gZgkURNJ/xF3NT6Uwrw5M0lUhZxHKPi7+gFoYAP8EpqM5r05nPiqgbY+P2A== 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)(39860400002)(136003)(346002)(376002)(396003)(451199021)(40470700004)(36840700001)(46966006)(41300700001)(478600001)(82310400005)(36860700001)(86362001)(316002)(70586007)(8676002)(70206006)(6916009)(7696005)(8936002)(5660300002)(40460700003)(44832011)(2616005)(336012)(186003)(426003)(36756003)(82740400003)(81166007)(26005)(1076003)(83380400001)(2906002)(47076005)(40480700001)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 04:27:14.9275 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f20dc08-d457-404b-b103-08db3a450724 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: AM7EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6703 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, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Luis Machado via Gdb-patches From: Luis Machado Reply-To: Luis Machado Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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));