From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YFOkFpua5GS2qwgAWB0awg (envelope-from ) for ; Tue, 22 Aug 2023 07:23:07 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=H1nTsM33; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 582901E0C0; Tue, 22 Aug 2023 07:23:07 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 33C0B1E0C2 for ; Tue, 22 Aug 2023 07:23:05 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C8C03830B66 for ; Tue, 22 Aug 2023 11:23:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C8C03830B66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692703384; bh=Vcqn9AMq0NLjfuq20cMKuWEN7ql10I7cTwO4/k2FL/U=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=H1nTsM33HTogoBxgWidv5ArV0csKDfZPV08biW5QOsgLSMTXVR7/teU0Q8Zeld6Uy NU7f8X1NEHHMFpUDppBMG7U33MxG2uBGsq5vAkn9TS0ZTt2qgs0s1nNHH0hb/Yy2Xv IcXFMbNCYdNsVXS2EWY7TwPGjarryj3rj6ntr9L8= Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2050.outbound.protection.outlook.com [40.107.247.50]) by sourceware.org (Postfix) with ESMTPS id 3FEFE3857724 for ; Tue, 22 Aug 2023 11:21:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FEFE3857724 Received: from DUZPR01CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:10:46b::8) by AM8PR08MB6580.eurprd08.prod.outlook.com (2603:10a6:20b:369::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 11:21:49 +0000 Received: from DBAEUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:46b:cafe::80) by DUZPR01CA0017.outlook.office365.com (2603:10a6:10:46b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20 via Frontend Transport; Tue, 22 Aug 2023 11:21:49 +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 DBAEUR03FT006.mail.protection.outlook.com (100.127.142.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6723.15 via Frontend Transport; Tue, 22 Aug 2023 11:21:49 +0000 Received: ("Tessian outbound 1eb4e931b055:v175"); Tue, 22 Aug 2023 11:21:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 252c9363dec8e32a X-CR-MTA-TID: 64aa7808 Received: from 69bf143f2a3d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 20E5EC2F-D89A-4F62-B5FD-DB9AB8ED3460.1; Tue, 22 Aug 2023 11:21:41 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 69bf143f2a3d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 22 Aug 2023 11:21:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X5V3sN9+elBAi3CYlt62QtQFmwCGB99976F6zshknXoMNUwRuZ3ZiOTpsiRSJsKJKKEWUq4ClkqN4jWt+sq3u5KTGmDLoC4asZpx2KwHNKmjoQi2XGn0Be4AZ5/gg1lylec5bQ1RUsB03n0a79oKqOUJ9ELHArhmQWX4bOjKJtBoaK9qmDDOeXi+qb4JFYkddV079cahMmK00xS5V/pbxCrNUGql9QhcQEGn9MCGe7G2gmn30nOjQySRcGBJqjTyu+eRN+kPEAa+Uh73GmAExdveT2JcMFtH85BlFsDogkSjLBY608MRqRKKJ8PG54h2e/0SxU+MvYkmfjhOYgyupg== 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=Vcqn9AMq0NLjfuq20cMKuWEN7ql10I7cTwO4/k2FL/U=; b=fcDeEF/ktrpKwTYi25Eh6dhNhlof12cr35l7UeBUiBz+SBfg5SREihVWsstnOLb2JdmnMjCmarUOXLfhlXdXqg/c8mfC03bi1wUqFuNicT4QlxaTJByg+hfz3e9yH+J4EzMBE0RymkxplJwk0NCbm9oNMoOl+AjlEb4f6TvcweORllrTuFn9FCThhbCey5EDGBOya/Onv8N6xB5TXnTnn6w0E1BBZKPZvCzqJZQyJvsSIvNz7fxc/cR3EjxEhJom5cNys7wCSuWE3KoWHRZCo8L9vKds940wJl4gr2yCivA7fw9crtWNOPOMTbLxQVbrGsKGlw5wKIKlptTuQ2HuQA== 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 AS9PR07CA0009.eurprd07.prod.outlook.com (2603:10a6:20b:46c::9) by DBBPR08MB6138.eurprd08.prod.outlook.com (2603:10a6:10:205::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Tue, 22 Aug 2023 11:21:37 +0000 Received: from AM7EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46c:cafe::3) by AS9PR07CA0009.outlook.office365.com (2603:10a6:20b:46c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Tue, 22 Aug 2023 11:21:37 +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 AM7EUR03FT027.mail.protection.outlook.com (100.127.140.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6723.15 via Frontend Transport; Tue, 22 Aug 2023 11:21:37 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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; Tue, 22 Aug 2023 11:21:36 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.27; Tue, 22 Aug 2023 11:21:36 +0000 Received: from e129171.cambridge.arm.com (10.1.34.58) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Tue, 22 Aug 2023 11:21:36 +0000 To: CC: Subject: [PATCH v4 04/16] [gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target Date: Tue, 22 Aug 2023 12:21:18 +0100 Message-ID: <20230822112130.1513216-5-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230822112130.1513216-1-luis.machado@arm.com> References: <20230822112130.1513216-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT027:EE_|DBBPR08MB6138:EE_|DBAEUR03FT006:EE_|AM8PR08MB6580:EE_ X-MS-Office365-Filtering-Correlation-Id: 12d47ac1-2f7a-4427-6e1e-08dba301fa2c 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: FzxKxh562dhZ6UHuifeDhfShNv8lRFQriC29ZgQ/38hIwYfYUlie61fqLDh9D2uuWM2asnW6pEk5YrZbKgET0qIhZzj2kU25zFLwnugI4PGUo3yiuzuC5dpH/lbuIyzjpd92O5U+3SwGRqkqDpBuYHJG67rgUz0LWFsV8Uihxg+xVsVHUe+wUgKx8a3k1vLjSn8QX0Fnw5NokJ8zQHPQM25fBEo3loVvt+KATiSNvX3boLIcVCIfsf/JQxib/liI5LNyiXgDD9lM4PoUZ/q6aWG4KkJr63QW6amkde4Oke9cr9+TiX4TaK04xFBpwuVePLkYBPkoLzTDzUmwD5jUrF+s9uUebQm6s6HVPJHbB5xe6fs0cgRdjqhuyicWiDRPxGGQQJ9rku51A3YT/xCk5KfnotCV0vgbC+REG261jteo1iWvFA79YIlUmGXTbYZpn3jysGJ47lXfrsmRcRseSdAqehgrLsQqEFYQYn4Op+0tvEOHkT/jHn9kH3nQvCmh4QlcBN4ywXoCH3cwbdTNxxffsLZra+Mz3nXIcvYA6NVnr21WZ/0xxM1wYZRQAIkxOTo+pzQVNg0YzqPhGcK9D4FQQgDiQB7wjp9ERGvl6zgMHlLm0JGbP8F7Ci95O0rZpK5vxwZXS8iIbOaStI5xC+8yksta7uCV1xU/884CtjZmZCGooyt+6ZTl6OrBXVj7DhwjujNeZzfRV3Y9iDY9++BL5ZDTFBEqBvpMd4DKLZhBkEtklBwiQGHx/u9CVG9dck52ggJdmKQwVBeqPSl28w== 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)(136003)(376002)(396003)(39860400002)(346002)(1800799009)(186009)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(6916009)(316002)(70586007)(70206006)(8676002)(8936002)(2616005)(4326008)(36756003)(40460700003)(41300700001)(1076003)(82740400003)(356005)(81166007)(478600001)(6666004)(40480700001)(83380400001)(2906002)(86362001)(47076005)(7696005)(36860700001)(336012)(44832011)(426003)(5660300002)(26005)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6138 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a18f4ba0-70d3-46af-cbbc-08dba301f348 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jHnQ9Ba5+t955pguYb5cuUxG3xTP3esUI0DdLfSum0VGOY6Ns38b7gLOFK4OmNFAA5WabvULVVCIG1+XFKpLndU6tCrMxoAi0ae6fkkdFGW9CppgtX9F6zUMhIe7HcZKkatZOuBgVIW0agrQN3se4sJTGwGUlmEwTebPJoicJT5UY2bngv41EbzOYdsb7BdVj3w/vrnVQ0fqa9Asr3bEJbJ417x1KLhv29hiQjRAR6HaTBC6Fy7p9AcC6AAH8UZdzZCYr7Ad6okpJtNNCpvifGBZke0mEka9jTJViZuM1yWYS8oKadC3lE3ZkrOxgnUWc0OEG2vscXkIhitikPYwDAqtwqiM+J5tR6jk2ZtjCuUsmRUGqv0iDpZWiS4E8d3VQ/gZC7oNRjRFyjhzya8VUWN9NqZV5AF7gtSej9kLg/B+8kh8VbK1fBPbJUd6LLU5QA9BNFecs4wPo3hXVCPq7+mA8+KTf1Q9DJALtiDVC7jxx73/E7mEl2HfxtxtUQk8Iry+8mTGOS+dXJ0XbrTiD3XPZaq8g6ZY0ZDoJ9encaS7r7LYlQD8cxC0PE+KiNWOytiNcgpnwG7D52t6VQG3inOQiNybeysq2VQQtvD6f2vZ1Mm9vvI9+VZOxDD/c0HnSJt6LEELlVFKeC43r4cFSn1htSMzgm4EOvSMXepHjIL3ygwjXw9ikkeRtz8fkEPaFYsyEepHX4VHvlQwUpHXIqxKuoSp9TxwHBVc8r1sU4plc2OGPBNWiNEeV6j0Y50N 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)(376002)(396003)(39860400002)(346002)(1800799009)(186009)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(6916009)(316002)(70586007)(70206006)(8676002)(8936002)(2616005)(107886003)(4326008)(36756003)(40460700003)(41300700001)(1076003)(82740400003)(81166007)(478600001)(6666004)(40480700001)(83380400001)(2906002)(86362001)(47076005)(7696005)(36860700001)(336012)(44832011)(426003)(5660300002)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 11:21:49.0567 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12d47ac1-2f7a-4427-6e1e-08dba301fa2c 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: DBAEUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6580 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 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: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" In a target without SVE support, the V registers have a size of 16 bytes, otherwise they may have a size bigger than 16 bytes (depending on the current vector length for the Z registers, as they overlap the V registers). In aarch64-tdep.c:aarch64_store_return_value, the code is laid out in a way that allocates the buffer with the size of the register, but only updates the amount of bytes for the particular type we're returning. This may cause a situation where we have a register size of 32 bytes but are returning a floating point value of 8 bytes. The temporary buffer will therefore have 32 bytes, but we'll only update 8 bytes of it. When we write the entire register back, it will have potentially 24 bytes of garbage in it. Fix this by first reading the original contents of the register and then overriding only the bytes that we need for the return value. Tested on aarch64-linux Ubuntu 22.04/20.04. --- gdb/aarch64-tdep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 21dd6c7a38c..b1d7da91754 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2417,6 +2417,11 @@ aarch64_store_return_value (struct type *type, struct regcache *regs, ("write HFA or HVA return value element %d to %s", i + 1, gdbarch_register_name (gdbarch, regno)); + /* Depending on whether the target supports SVE or not, the V + registers may report a size > 16 bytes. In that case, read the + original contents of the register before overriding it with a new + value that has a potential size <= 16 bytes. */ + regs->cooked_read (regno, tmpbuf); memcpy (tmpbuf, valbuf, len > V_REGISTER_SIZE ? V_REGISTER_SIZE : len); regs->cooked_write (regno, tmpbuf); -- 2.25.1