[v7,04/18,gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target
Message ID | 20230918212651.660141-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 19C2E385C6F9 for <patchwork@sourceware.org>; Mon, 18 Sep 2023 21:28:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19C2E385C6F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695072532; bh=OFswgQHWfr72XoqwXLCGiCCryhlkUSoIcgrJUyGN4cs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=aIn5G4EIA1rIIIqE8Qj0Geh3V3ehBhirBMY2OIDmlWmGb9Bl3jX7blf3u1Jp/SOoF amqHJg0ws8fWXMNnCS0DzdbNAnmYX6E0+LKgwfF36SyCylXBUCsqBnNtPgz8E3Dy0t ntBPzJtILwBrFFDxlVWTSvAHEW01h9lIdn6c9PuY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2083.outbound.protection.outlook.com [40.107.8.83]) by sourceware.org (Postfix) with ESMTPS id 095893857730 for <gdb-patches@sourceware.org>; Mon, 18 Sep 2023 21:27:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 095893857730 Received: from DUZPR01CA0080.eurprd01.prod.exchangelabs.com (2603:10a6:10:46a::9) by GV2PR08MB8704.eurprd08.prod.outlook.com (2603:10a6:150:b9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.24; Mon, 18 Sep 2023 21:27:15 +0000 Received: from DBAEUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:46a:cafe::f) by DUZPR01CA0080.outlook.office365.com (2603:10a6:10:46a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Mon, 18 Sep 2023 21: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 DBAEUR03FT059.mail.protection.outlook.com (100.127.142.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.14 via Frontend Transport; Mon, 18 Sep 2023 21:27:15 +0000 Received: ("Tessian outbound d084e965c4eb:v175"); Mon, 18 Sep 2023 21:27:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 22c302db4197cb5d X-CR-MTA-TID: 64aa7808 Received: from ca8a8f99bc65.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A02B993F-38C5-43D0-8413-68F0FD5EA823.1; Mon, 18 Sep 2023 21:27:07 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ca8a8f99bc65.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Sep 2023 21:27:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L0pNRhhDqV1XepuHgdrz/X1ks+5bT+tQtj56FNuPMA3/shiHaS+tluknx9Op5OAdT+hLDmn9Cc29Sl0+Msc1KwHU4Qh+BV1tNwv74ENlSr1AOcXuRqE1BvitzIsqpNm05VqCYwa3ThqBPES1f0Sd3HR6MpXFL32CLuez+XgEUIRzWas8f0452V7/LbynDHwQZ/eEEnkYQ3ThhtLMoeaAsr0GSK0aStcxj5+Fi1enLQ0yU1SgUIOC5h9ViUdAIf1EtT9JSaB1J7kU8EnPhxhZSMyC8PIgskIlfg+wYj4uFu9FXbkVzFBF22EC1SZM1NKrDi/QGYc5BnLKOpQ52fJxHg== 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=OFswgQHWfr72XoqwXLCGiCCryhlkUSoIcgrJUyGN4cs=; b=Mtzm0ZpULGWzPA06P6W+W087avOhC8/k//6/HVpbugN1dspbMIjfImaOkju/YD6sAzoX3EpoNG55SQXy4vSnwXJYWFId8t3lvT2vDRKzrJywBUpm3YiwMzCvxbXplSm95OFB+B39kMtuqLE8j/wjgOrA35hMxgS2CbQpqiN16u5dfZEJDETDj1MR35w95HAsP0naYVQOdK9BKFxnPdiWtRNV7UskUWeLSDy4OtjIiepHQ1SDz56lvycYYXrJPdyj96i3Oh07Ip5gpDZNzetZFWMNsGbmgwDTuetdTPVWJdO2CvAQJfIadx/TiRY94iphxrAOxKD5B3kjRmJ4UjDtxg== 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 AS8PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:20b:451::17) by AM9PR08MB5987.eurprd08.prod.outlook.com (2603:10a6:20b:2da::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Mon, 18 Sep 2023 21:27:03 +0000 Received: from AM7EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:451:cafe::2f) by AS8PR07CA0022.outlook.office365.com (2603:10a6:20b:451::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Mon, 18 Sep 2023 21:27:03 +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 AM7EUR03FT058.mail.protection.outlook.com (100.127.140.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6813.16 via Frontend Transport; Mon, 18 Sep 2023 21:27:03 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.27; Mon, 18 Sep 2023 21:27:02 +0000 Received: from e129171.arm.com (10.57.64.238) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 18 Sep 2023 21:27:02 +0000 To: <gdb-patches@sourceware.org> Subject: [PATCH v7 04/18] [gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target Date: Mon, 18 Sep 2023 22:26:37 +0100 Message-ID: <20230918212651.660141-5-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230918212651.660141-1-luis.machado@arm.com> References: <20230918212651.660141-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT058:EE_|AM9PR08MB5987:EE_|DBAEUR03FT059:EE_|GV2PR08MB8704:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bdda96b-06ab-44bf-4d04-08dbb88e076f 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: k8a3hrBeHIPQyDmfmWbWj57YRcaKbGwUgXed3aGh+mUZq82+s4gXNHQTAQMAugcOhROAmMuDwk3X9+lepbOtTMEFE15F34D4m2ycjdnCtZ8u9ojo9oLrP782wIWFzljZBBPu9+cdFZuugFZFeZd+PL5AasipzGKrhNNI1DWXm5BpjYv/Kj+HTuLH0QcGDALDiHAz2TmMQAawL5+NziBSBdL02SpNFz94+9HXZ8R+qJk4EoRF+zqVax/KJv7iJn0ToM07ZZv8G5VCJMAYe8IXvAFyCXOBOUHpZR9GSMyY2CNVPnW3BpfDXLUak3doDNY6Hxz8YahhYuZ09B6q6Ng4rn/NDdpZgF8yhmGBnJ8gyFiVXcj1cU5n558CALQW45qR5WXM+e8SsQCE84HzKZwPlziqcJiogTdjHsl5LSPYhhHnytC5gdxLmXHy38RsZnumIZhldbGiA6FFa9zWpszrwM21ZHDYBJO+ZIT6NfurzlIzL+CksmzmPByv9RGM3d28c7fYMlFgoQvxL8DsYbvRvDUeEp07Zs5Fl2Kv/9QJ4BxeOTQA0mg7gtFFJgG76N4UbL/oXNLZL9ZR08cUJJhceDaKpBJ7XLMNaWy8iGJKV0t2kmIMJNvD+CU7rkA2947AV3hi21KO7FubnVsz+bEIqzJQGH3EG+M/UxjE5BvrzyHDXWuC4CHC0Mtjo47r3xSpWnK0tPyrxSupabQODF79OeT3CuY8gGfTsJmjhevJGTgLfge+5u77ugmhcUoPGmml361RGrIV5M+2v8yGmVFNjA== 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)(376002)(396003)(39860400002)(136003)(346002)(1800799009)(186009)(82310400011)(451199024)(36840700001)(40470700004)(46966006)(40460700003)(426003)(336012)(83380400001)(2616005)(26005)(1076003)(47076005)(41300700001)(36860700001)(316002)(6916009)(7696005)(54906003)(70206006)(5660300002)(8676002)(70586007)(8936002)(2906002)(6666004)(4326008)(478600001)(44832011)(86362001)(356005)(82740400003)(81166007)(36756003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB5987 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 49eaa243-f56d-4fc1-e6ca-08dbb88e0046 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pqbr/tlJRIxON75akUMZhRe9x7yvmO0vZShNhZkQVRqYB/4L2qx2RBUkWwM/+YWSlRCITle314EiyKnTJiA43F0KtwY/g3HZoDFCzgzi7q+t+nWwGwwOvCpu+tH6e9yR/8tBrjyYspX69MgqRvUhsoZ3xl/+qfzG8MaAp704OjzXLstl9Veusvg6pkDiakWkG91pyUQni33lgRDw6aYzTTszjxmUTVwzOgHvBbsJzFRLyD/wsKqFXEiX9g8jhK6BnMiprzSwka616wUNg2OJS+oJY2p7N68Pwa7d0D7JYsgumDH1iEVLUTl40ZJP6o9f8DSTw1YxFSdKAEzE969SJoJHc3zA9IGn1rmb2lKOkIgPzR02pEUX2a2AxV8jg5JR1JC4h1STaI9FuwRoT55aEG2kU3d4poq/hOASZ7IUSbZTPp1wl0AVCXGY9psb/BodGjn5jqKbTQ+YyJYJjY4a6XJxK4MEPJpFfiO2fLrNqjhChHhzPGo4KP6Hucm/t5NaRSwik+HbAPv1F6PPspySWKlwZaZK0cSBQl2d2KTxxY6poOtofeJkwe1Qu7HgMunvlj5DtWqG4929fnMigLWUNWXc1FJi0zIa4NUUrMPy/S48aQLxny/KdaSJ54EE67MFwkCwbzp6bW4BFAsrNiHmE7+SBjJ8FCP5rB4UhWLdbOMQZJIOu7RDxhb51pZ4cb0U+DXnd07FhSw0KKg+K1o4sh8RiQmPeTPYGli80DymlBjNvbfYQ/8t9nVNLOBhRmT7 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)(39860400002)(346002)(396003)(136003)(376002)(451199024)(82310400011)(186009)(1800799009)(36840700001)(40470700004)(46966006)(70586007)(70206006)(7696005)(54906003)(40480700001)(44832011)(316002)(6916009)(41300700001)(6666004)(478600001)(4326008)(8936002)(8676002)(40460700003)(1076003)(107886003)(5660300002)(26005)(36756003)(36860700001)(81166007)(82740400003)(83380400001)(426003)(336012)(2906002)(47076005)(2616005)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 21:27:15.2658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bdda96b-06ab-44bf-4d04-08dbb88e076f 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: DBAEUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8704 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.30 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> Cc: thiago.bauermann@linaro.org 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
Sept. 18, 2023, 9:26 p.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.
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
---
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);