From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2086.outbound.protection.outlook.com [40.107.20.86]) by sourceware.org (Postfix) with ESMTPS id 705853858D38 for ; Mon, 3 Oct 2022 13:16:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 705853858D38 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=H8BCA3et4nUHR0tfFQWY8Ti9lEoK9jmUY7KUrU5ZHX28o/yRUQn2GrhjPyfkDQbaVe5qMyOcuat74HWx6JAD2hvRqABnDLja8C4/QEmV2eE5MUjclND6xa5irhp8HI4zDTmIs6Qcefe1wZI41dTsZQYXBFD7uH7CGtswxWEimODhkRmniyzRTQ0TCWE6SAPskrxANcpR1/JP1ZlK/8s7y9tE6XVOqmeopFAvA8Mml8p8yENT+S/yVYzN35s7plHbXQrLZpvJFD5Cii0/fuuocta65I8eotVfhyvZwF2aL2rUJyOr5sM23r5ohNcAzJZIJji9/pZRDVjToI4aU0mUvg== ARC-Message-Signature: i=2; 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=OCkIC4pXbpnC48y3zQd8rnmQvFH/c3GvWs9HfvKxKKE=; b=feQfXqwLhFygKKbPqNOyTUlpd9dgzjndKEodCdIiGhih1rOjGwxhPKoqKaUFOin4vjfA3IEyTVyMO4yDVb2ohB2V2bNLLY8IdtsgKpefBK3Bu/Oa+ORvOJUrryhMYxcAraYagrPyF7PM4yglqMj0f0BIMycSly9sWsVIN35PIoK3Sw8Vh85FMUiQzfX0lXJebagjQuwloEABS84iw7cWjG8zxcBnwLLjRt5yLVlCfkiGQVGwMMFqfgo1C0AH8e17JF9Y9K2YgoR0IRll/yc+hOzf7U2QDgB1TN4pfwRF7ggEyAaCSTZdWvUjjjQgU2SJvtWo4C0ue/tEwGhgIkQU8g== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from DB6PR0601CA0048.eurprd06.prod.outlook.com (2603:10a6:4:17::34) by DB9PR08MB8508.eurprd08.prod.outlook.com (2603:10a6:10:3d3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.19; Mon, 3 Oct 2022 13:16:33 +0000 Received: from DBAEUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:17:cafe::da) by DB6PR0601CA0048.outlook.office365.com (2603:10a6:4:17::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.29 via Frontend Transport; Mon, 3 Oct 2022 13:16:33 +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 DBAEUR03FT010.mail.protection.outlook.com (100.127.142.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Mon, 3 Oct 2022 13:16:33 +0000 Received: ("Tessian outbound d354c7aef2bc:v128"); Mon, 03 Oct 2022 13:16:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c207d4f9cad2c820 X-CR-MTA-TID: 64aa7808 Received: from 181bcbf04833.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 59EDE60D-C0BF-4CEC-9D95-247C918FA386.1; Mon, 03 Oct 2022 13:16:26 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 181bcbf04833.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 03 Oct 2022 13:16:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aNO3rMihmvmyZASwp55/llmGCHB7JPMmeaQwmhid26RuIFEgxd3aT4ZerF0P2DuPG50aDDOrx2LBLiSC0swFyW/mHzZw0ZksFnJNK09HggmgqG+MhEZrcGtFZM0iNPbEbc4dFnUxMvo21IwYa0s84KpIck7Cc7HTx+e6wK7YTcH/DNmb4tG8AL1JetviVIEnf63cNNQbZBE5nKLr/5wY731NkF04KQxttVogADb2DkU6t8tigQyPchNH1QuuenBAaaTAVfTW5dYDk5gLeCD4RZ1sN3V8JSN1OZmWj0RcRv0LmiSbDpMjQV8pmECoAs4KPWzFhaOsu34ZglS4i3R25A== 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=OCkIC4pXbpnC48y3zQd8rnmQvFH/c3GvWs9HfvKxKKE=; b=LYQL//SfJovR8lXZMxJnXlNhP5scEqVmiX41RRcVvxJ42/IlKreP7qba0FRjUn962WYd4pWocuWiZ17nBddc9xvzCkj2X4hMuY5zW7Hz6lD2469Je0JAE0w81Rj4CeSuep7NkAK4t8Pmu21uckHXQEUPJVdbbZNBuKhW2VHCNPIkTn6IKC1sMrVQOzZ57S/MAqWqpvemFFnIGkw7YVjhCHG8EBXliTczUFTPmVZWep961UV1riKb6YKZwE0a9ubdazVdMG7xMbfWGAioXM/sPrHPT3tR9vs1ZoRrBTqT0zBFsbM8n+GmWBnOxTmL0jUEYNQM1JPYd5ZQBlHCyx1zLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by DU0PR08MB7566.eurprd08.prod.outlook.com (2603:10a6:10:31e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Mon, 3 Oct 2022 13:16:23 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c5f9:a25b:a5f2:6094]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c5f9:a25b:a5f2:6094%5]) with mapi id 15.20.5676.028; Mon, 3 Oct 2022 13:16:22 +0000 Message-ID: <6cd56353-ce54-46f3-c985-641117cb6e41@arm.com> Date: Mon, 3 Oct 2022 14:16:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] [AArch64] Fix pseudo-register numbering in the presence of unexpected additional registers Content-Language: en-US To: gdb-patches@sourceware.org References: <20220921175329.1005517-1-luis.machado@arm.com> From: Luis Machado In-Reply-To: <20220921175329.1005517-1-luis.machado@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0025.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::12) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DU0PR08MB7566:EE_|DBAEUR03FT010:EE_|DB9PR08MB8508:EE_ X-MS-Office365-Filtering-Correlation-Id: 95901913-cddd-4400-bd9b-08daa5417e08 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: jjbHdLXWgkZOHa71T1vlSsFIZWkHWNKbhspOUa05eFqrljQ5LitjMru2T7EIsgBfc7L/4J0aUtaz7DzmFgZn2X/cYzLJyGpE0K8nLZ/Em7v9H/gYrspyKRp8i1M66iAIXZjQjjvkAuT+sPV9S+eDDj9BMEHdZD8VlhFaKW7E8o+5XVDWsQ2ELugH8qJ8Og5Z/4cxsqjoLpeViAaXdg+skJg3CKzcb9oG2PN+vbrEx5ViiZvzbNzKX5AfOxm83YGHnrNlbu5cBDrCKZojfH0kTRKJe8nmun47RFexhzx0xopMyNniO8JyKHCfGAq16ds40c8ejwYwIkNc23zZupElYrsSRS2lRw1qh54La0NONdctgPYCXUJxUPPWCRIg/iBYjn994I3Y7dcs7Zs9nyzVNcEsxz99ugy1Uuq3JBGYgSxknTWnWWLB3pWq9olRcvtT5QxyK7x+pQ/tlT080fQWX/rxSuwFDSP8ItjiYjAdUQ+H9Aa+DQMX8SCP4SeBWQ920fx+K587RP/TNYRwlWLgqyfN5m85CHtjOOJj/krQhjrTbZ0irVlLXi3lPg3tD3zLP19pKko7Kj6v5hyOM3Efj0r3FRAOBrNCD37xwDTo0nmCuE9WIKTUSJ1AVnE1dwH7B5APfUMEeGkkGBtpQLZ7ZlRnpqgORqLOaeB3i+2asanIRDadO4XlwcU9NmBlkP3o/5Z+vVR32HTVsLYDGJoa1fyOFuZwiXigIdOlDiHT8mO0UypUEBbGn9c2kFvRdf0eGt0fJAvolfX53m1GOKzx9+ZExX3NOxpo89MG6W9R+3E= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(366004)(346002)(376002)(136003)(39860400002)(451199015)(53546011)(2616005)(8936002)(5660300002)(6666004)(316002)(2906002)(8676002)(66476007)(66556008)(83380400001)(86362001)(66946007)(36756003)(41300700001)(6506007)(6486002)(31696002)(44832011)(6512007)(31686004)(38100700002)(6916009)(478600001)(26005)(186003)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7566 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 2e1b3cae-c48f-4fd0-d7c6-08daa541774b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rFFCboLHu/zWQH1OL+BlFOBHRTi+rqRXx0mFYb/nl2kAJtIrR3z+MOZyskDmCBK/JXgbigmF4LBg5wBhIrbKWYeoZbSGTkB37lgi5opKBgUZJkF1WLOCFdSMiNyr76Van7mluNu1HJCjM3/qtyOJ0QjjGA3PZbNo/vWZVHgAlhztKPtTtr+9EeUYAOSvtUlK4CAkyHvnvRnwH8YKkFd+Osyv8EAlQeXovey5o5J+uFrU+cR4fg2aZ7cqOqaEjUPLIIAnLmArhbgJYQ/Jn9+B3HTB1FQlUU5SsyEdz26coQRUk0brwZwejVUu5219SYkBO5qWBO9H4tWOklPmYXh3qb7mrjJsT53UyFqtkcpJFexk2PJVXdYsA+KlH9zSHxkZd9cdBME2sS6UHumV6Ta8oGhqgSKywGWwOw5/lO8lbr/ndxaCnd8bLBzGQTVPFNss+FqMP0/VEDKwLABmVpjmKiO0wM5y0NHOhqeRgysHVhfFrXAOK+xtEOPuG0TOvjOjeNvLH+fS2S/J4OuuXQz4HjbveHyhfMCn2DDvjZDyjG5qRu4ULrIODPJUueOcM6hpno2OHttY1wtv5us2WFYChEbS/Pyy4WShQUPgRfpTBR/IGsv80S3wooAdbVJkJAoommr+U81X2VilOTkp4ym+NmTIH3FAotITG0edRqmBO9M9Np499s4PxW8lMpsxin2UGm2Ckrws/V4lOdu6+Mx8rMHkzcGSb2x+1cG4LOPbfR5f34uOpzLjaLxUFxPC2gkTRlYPia2eRkAu1JHA9dmRt5KTeCLMuvJJLhiLOQfE/DrbCeyAXXITfapHxyZd9Mn0 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:(13230022)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199015)(36840700001)(40470700004)(46966006)(6916009)(70586007)(8676002)(47076005)(6506007)(8936002)(53546011)(82740400003)(70206006)(41300700001)(6666004)(31696002)(186003)(40480700001)(36860700001)(26005)(356005)(83380400001)(6512007)(478600001)(2616005)(316002)(6486002)(336012)(81166007)(86362001)(40460700003)(82310400005)(5660300002)(2906002)(36756003)(44832011)(31686004)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2022 13:16:33.2149 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95901913-cddd-4400-bd9b-08daa5417e08 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: DBAEUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8508 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, NICE_REPLY_A, 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-List-Received-Date: Mon, 03 Oct 2022 13:16:38 -0000 On 9/21/22 18:53, Luis Machado via Gdb-patches wrote: > When using AArch64 GDB with the QEMU debugging stub (in user mode), we get > additional system registers that GDB doesn't particularly care about, so > it doesn't number those explicitly. > > But given the pseudo-register numbers are above the number of real registers, > we need to setup/account for the real registers first before going ahead and > numbering the pseudo-registers. This has to happen at the end of > aarch64_gdbarch_init, after the call to tdesc_use_registers, as that > updates the total number of real registers. > > This is in preparation to supporting pointer authentication for bare metal > aarch64 (QEMU). > --- > gdb/aarch64-tdep.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 7229b53838e..f94e810f904 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -3598,8 +3598,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > tdep->jb_elt_size = 8; > tdep->vq = vq; > tdep->pauth_reg_base = first_pauth_regnum; > - tdep->ra_sign_state_regnum = (feature_pauth == NULL) ? -1 > - : ra_sign_state_offset + num_regs; > + tdep->ra_sign_state_regnum = -1; > tdep->mte_reg_base = first_mte_regnum; > tdep->tls_regnum = tls_regnum; > > @@ -3698,6 +3697,18 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > > tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); > > + /* Fetch the updated number of registers after we're done adding all > + entries from features we don't explicitly care about. This is the case > + for bare metal debugging stubs that include a lot of system registers. */ > + num_regs = gdbarch_num_regs (gdbarch); > + > + /* With the number of real registers updated, setup the pseudo-registers and > + record their numbers. */ > + > + /* Pointer authentication pseudo-registers. */ > + if (tdep->has_pauth ()) > + tdep->ra_sign_state_regnum = ra_sign_state_offset + num_regs; > + > /* Add standard register aliases. */ > for (i = 0; i < ARRAY_SIZE (aarch64_register_aliases); i++) > user_reg_add (gdbarch, aarch64_register_aliases[i].name, Pushed now.