[04/17,gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target
Message ID | 20230411042658.1852730-5-luis.machado@arm.com |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 94BD63857706 for <patchwork@sourceware.org>; Tue, 11 Apr 2023 04:28:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94BD63857706 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681187296; bh=O7CkPTCVPgLsNCFKX5R6IJ0QJqieMar4tj16pI2vPR4=; 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=ULyW2OlKlHsbAkxY1kxYHmiRccp0pyTWGbRUxpzGQY8bt3aqVLnXa7l8UsTLqXL2u qRTqFsWQ05t32wMdvv+cAZKRUKRkV4R+a4m8qB/6QBa/4EMk7e0Q+a7mh7prAZvCB9 wGqMH2C95SbD9VpfFF/Cfa0x5WH+GuNvutRtCFB0= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by sourceware.org (Postfix) with ESMTPS id B83DF3858404 for <gdb-patches@sourceware.org>; Tue, 11 Apr 2023 04:27:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B83DF3858404 Received: from DB6PR0301CA0102.eurprd03.prod.outlook.com (2603:10a6:6:30::49) by DBBPR08MB6059.eurprd08.prod.outlook.com (2603:10a6:10:202::10) 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:14 +0000 Received: from DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:30:cafe::df) by DB6PR0301CA0102.outlook.office365.com (2603:10a6:6:30::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.39 via Frontend Transport; Tue, 11 Apr 2023 04:27:14 +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 DBAEUR03FT012.mail.protection.outlook.com (100.127.142.126) 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 3570909035da:v136"); Tue, 11 Apr 2023 04:27:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e99359c7d651da21 X-CR-MTA-TID: 64aa7808 Received: from 71bef0405dcc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 19BD9F33-77EF-4F4E-87E3-A64283735B82.1; Tue, 11 Apr 2023 04:27:08 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 71bef0405dcc.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=PK+0f93Z6xUOydVbHMbnqncAlZIAkl6gaCpp4ENYt+Tuc2a6tqGWTAUpOcr2Ik0oa5D1xaRIRueg+T7QJx47Mu4OLDClVP1+Drp//mhNG5Q5F+57NZKdA0SvNi8RcBKZD/uhl6WgQR9cLzvyocpHFgW6KVO+gDRReRsd6rgrBK+muGLvzLwvibPKPhRvuO6mB5w0LPXs8R9jceC3WWqA7e3KpQFluFzUE1TLQrjUbE95w8xWmaxoCp/W4J1SUAfmS0oJGTzL3E7e0pnMNJPgk0griMN8qebCCC/EzMGJZhRn4wfmnDOqHQ4iISQPEEb2HA7vLDaptL/F4+B32oOJWQ== 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=O7CkPTCVPgLsNCFKX5R6IJ0QJqieMar4tj16pI2vPR4=; b=FvZY3NzAWQJnlHtfrcPFX7KxLrzE1LLei1NskJCHbvWM2Arpcm9gsGZKZ7nTOVP/AVm2gr9RL0npNPLVHFGvPrW6hKvZtz50c8G54miQ4y4HaWBHlKr4NAUbxCqmdXlIFJTmcckpiZOkNHWrlVPkk06daxTkATEGs7QqmFZzdQiMlzcgoL/KJZ6pkyeTH+VwohR6eYU48A0RGWaqWOlFFnUMtafLIuPmCjdsdYUGEKzuNJIwouMCSeTCHEbMa2sMdZOHOKSQcV50+JYPvMU3z6+VKUiCTneV14/vXIIdsfBz7fJPbHjCEGs3lwkAYm4XFpFC99ZWAz5N+UFo0lgODA== 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 AM6PR10CA0064.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::41) by VI1PR08MB5439.eurprd08.prod.outlook.com (2603:10a6:803:13b::18) 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:05 +0000 Received: from AM7EUR03FT046.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::68) by AM6PR10CA0064.outlook.office365.com (2603:10a6:209:80::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.40 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 AM7EUR03FT046.mail.protection.outlook.com (100.127.140.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.28 via Frontend Transport; Tue, 11 Apr 2023 04:27:04 +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.17; Tue, 11 Apr 2023 04:27:03 +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.17; Tue, 11 Apr 2023 04:27:03 +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:03 +0000 To: <gdb-patches@sourceware.org> Subject: [PATCH 04/17] [gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target Date: Tue, 11 Apr 2023 05:26:45 +0100 Message-ID: <20230411042658.1852730-5-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT046:EE_|VI1PR08MB5439:EE_|DBAEUR03FT012:EE_|DBBPR08MB6059:EE_ X-MS-Office365-Filtering-Correlation-Id: 1570db84-9295-4853-0388-08db3a450704 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: i2zL1NWoWj+sDJbIge5XxtFMl7clrly0SiOT9murXDVIvw6nULa4Wqtl0Zh3WZy/Iw0k3lOrSdwhwa+rdPYtSL8bUI/+F5iTBe1edpJsXLECdGmzKbjw3HWaKk/mY+5D4+8CavQtj/yvuiOQq+2gTalBGhVdV/LFIrWGrmbQQ637atI3s9HLDiYnbi94SD9GxBkxZ6Np7v+NjIprCSFc2IXP531t4WgSK3uLiUW4E/SUdbK0Y4zkRqj1Fh7VTj/6NikB0T4uy4r0FHfyEST3/yswZd3SldWMRLC5m9T0j9OS14zd/xx3DtUyz2/quHHvCdTB7gBPrVxeNwXf6+Mqv/QGly7eKdanrj9uRkBh0M5c8hFnSaLRf5I2uXqVObFnjwaPxLfTuxVGmFK85Z9sxMaiKoFDAclHD5f5q4Ki7aqcHb0vr2sOQy+J+DNNg5UulpWcZ416UqWhLwjJM6x3dKQn7xWL0VZs7mbr8IQiBS8Wa5soivNuyBaQG7JWiaiVe7ONy+SUC608PkFp/0e0ykh2WwfPxRAKcbZpUzS6bNHclKJt1RxUc4lKpPWVQiYogaX8b+UTfPfuJS2Uwcy0SG5lKcjZyQE84b2uZtSDj4Tct4a1MyQqDmSf2z+WPV3v14rQ7i2XBfWi42+yqO2xU1HIq9Jc5R9aNxyEiQpw/yZE9lRUB6iUBAOIJ2IwkBJZWSnpAfHFo+Qe8XaUI+5q1g== 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)(396003)(376002)(39850400004)(136003)(451199021)(46966006)(36840700001)(7696005)(478600001)(1076003)(316002)(26005)(44832011)(186003)(6666004)(2906002)(5660300002)(70206006)(70586007)(41300700001)(8676002)(6916009)(82310400005)(8936002)(81166007)(356005)(82740400003)(40480700001)(86362001)(83380400001)(36756003)(47076005)(2616005)(426003)(36860700001)(336012)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5439 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ec55872-6b5b-45ed-d060-08db3a4500d7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YC7c08Gn6LdcvrZUuTbP3HqfC7i5pf4DWvn+GtNa3fN11cWeiZnWF4ZoBqVVYe0X8vaOvbgMn9djgdXJkUHO74AC4L4uuzGe7pryVu7cCzn0iH28Yf8IJvZ0LwXu/EpmKtt2fLL1ZV/pDZNXCqak8tYGA1PHjHQfAkklV59QtGndE+lLwwgwhdUc1Qq6aTNabb90gkxDVtVk+5r8fVjzV1WRbA2QMG0NRutPFHP1xxf0XhnxFrAzNvMdL9AxOISEbyBVsJF88QkYZMtCraJyzbwpCgDYsN6I868wn9Y+w17wIXp5IdXHqP32rVCC3qCQS7tm5o4iaTQT0yW9RBxxyo/wmsZmvuHQPlwMFYpaMaIFUrVbKPTvKzt2vdXkmwVZF5cF1Q42ezo5Za/INhfnL1Tk2AKd/PiTOYaGJb/BsnbD/gt5B4Xr44XavMUz91pGFfmIP9LTjFE9+g65bddOVXg0V63xfOAVixSA5/dz0LmXMYG9eUGt7uW/ba/imHi51KDiqb5Jm6OuP4HauYSH0bAAXy/52TOCj1vXZNRw+zvLuWlfsr0eCLtJugB0gLFrTO8vLNyYm6BJsmsEDsLKnyfcd2wbeTd3L8iMSPC1tSb7YPckEIOcFF729vUdTYtzcmJwYMB56hLk7x6kfPAX7X0Yqmp8OPARl/kPGh37DOGceLqDRX/6BCq29QDtOBFjeIdNUzAkNVUbYoW69cAADg== 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)(346002)(396003)(376002)(39860400002)(136003)(451199021)(40470700004)(46966006)(36840700001)(7696005)(478600001)(1076003)(316002)(26005)(44832011)(186003)(6666004)(2906002)(5660300002)(70206006)(70586007)(41300700001)(8676002)(6916009)(82310400005)(8936002)(81166007)(82740400003)(40480700001)(86362001)(83380400001)(40460700003)(36756003)(47076005)(2616005)(426003)(36860700001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 04:27:14.7915 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1570db84-9295-4853-0388-08db3a450704 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: DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6059 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Luis Machado via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Luis Machado <luis.machado@arm.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
SME support for AArch64 gdb/gdbserver on Linux.
|
|
Commit Message
Luis Machado
April 11, 2023, 4:26 a.m. UTC
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 d8349e4ccdb..ea0d8ce2e27 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2411,6 +2411,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);