From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2070.outbound.protection.outlook.com [40.107.21.70]) by sourceware.org (Postfix) with ESMTPS id 65EB1385742B for ; Fri, 28 Oct 2022 11:12:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 65EB1385742B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=USNUgCfcOtuTJoKT/PqaQjIvApVjiqEOnSp9JnvZJISdNo5kniqVltYyYXMSOfaMhk9584xCGrmj7Oyu1Ucis+7Kf3w4XEgLbC6V9h9gWaPgWzTX19az0La5atfwjK7FkiW/AIkOEF/nIClqLIAdD10+7WaaQ9CTPtCbQv72b16eYPe2pg0x3SO+sTsfW2+gzZB7SH5VNA1GfFE7gtTci+8/RzVn4BqgwUykkW2bPuaGPnvt6xyzt7Jr28tWrGyTvBclyy/88MebLRjuYM0f7Uoruka3VJXI9nIunaN5zc8awWcsu84xlEKNnc3V+ehAMPPdotbvWWBIGXMrf3ljXQ== 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=+4eseAFIqho+x88gsuzZcrCxqM5xdNp9B3fqXa3BxB0=; b=A1GanEn5FXASMrwQbxxuw9I3t3VCx4OoyjPXV+JXk2CCPFaZw8ExH3Phza5xOc7KHxE/lvIKuJwYkTR/8VyJ407wi8UMzwp0Ggn4kxYkULy6yTTjm3/BjBYj7M330uIFwDWj+oNtE9cc5Xz81qlClTogrsoyhQL+IyKptoSzY8FfreMIAUiuDSs5BhWM8FWCVH+sodPwtBpwVF9CLFte8rEZGFD3mkCxN11Jk3Q50X2HZGyHv06XyGUBWXeEzctFXTaA1xUA/rmR9yH4vnEpRPVw64OvasI/gee2c6cU5a/zUAn7ogG+yUkAyAlHuD/A2Ukp6K6u/TvQSHMbRKyqQA== 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]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+4eseAFIqho+x88gsuzZcrCxqM5xdNp9B3fqXa3BxB0=; b=dyQVz31TPQX4bpPVwSqKDnbP64ObpqK3H7HifEVoyRt44EbYA+24Tq7+H2nAQ39sPf80XhvW/GhMplobQJ//SYEYovuUsiMvRupi1a37AetyzkDvU4WkdqPGhjV754KWv3xCLzATv5ri+Bn0oXw7dXy1W0gIz/u9E/1eZajabOo= Received: from AS9PR06CA0478.eurprd06.prod.outlook.com (2603:10a6:20b:49a::33) by AS8PR08MB7909.eurprd08.prod.outlook.com (2603:10a6:20b:52a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23; Fri, 28 Oct 2022 11:12:03 +0000 Received: from AM7EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49a:cafe::cc) by AS9PR06CA0478.outlook.office365.com (2603:10a6:20b:49a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Fri, 28 Oct 2022 11:12:03 +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 AM7EUR03FT003.mail.protection.outlook.com (100.127.140.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Fri, 28 Oct 2022 11:12:03 +0000 Received: ("Tessian outbound 73ab5f36653e:v130"); Fri, 28 Oct 2022 11:12:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 74f839feb30ea29e X-CR-MTA-TID: 64aa7808 Received: from 64bbddd715a7.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 71387E4A-520A-4A37-9332-B33AA563A93B.1; Fri, 28 Oct 2022 11:11:57 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 64bbddd715a7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Oct 2022 11:11:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kdf8FsNH1Ep2ILPWK8s5DjwZIduth3w2WA9d8oal1a+P7wNLWdX0JNUE7f3P5McZKmZLNkvrtbELFuZxhkQQK5gVSkPNiH3ICeNt10jt1JaduEiuo5GX/meGwIP5yRnaxjKnE5y7SOWThpoH5fXXXKbKXWjIqdTkjLd4sSickyHI1iqS81lyGQPwi+B+CFUsQUhrHavDLYhveODHSgJ/+cB3YmufnA43IJPFrUiuc1D2wVvEwFgTFV4zjTVvDYbynQaifIkIKy35xu8y68BHzyUMXcd2AqKTwEM2OG3PLSGK+CRnmVRwT767X+CWOATMblEW/gcd4OpvUBr99BC0jQ== 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=+4eseAFIqho+x88gsuzZcrCxqM5xdNp9B3fqXa3BxB0=; b=lJE9tgz/6Jq+fHQVQ7b6MCA60H9+dX6Ap2KqI+4N2NE23qQSWaXwllWR8GjEPW9E3y/2DiMMpjArOjz0J4eu/qNTvnhf2xJp6DJUQinY2gvDmLY7YS6sW9pYWhr2XFAbyG8CmKWwpGeQZscJMNgfsJKXfak8E1u/hFFOj4AZxX1b1PWvsGGY+rrB0+3YtfkopzMw9XiumxZ/M2YTo02kohTAdWX5c1AKc8kHuxwfvS6XRMwTd1l/TNydqRxX0pTcH4DJOG+d5S43j1bOfzlQeW+0UKhMW2XOXhTZR+a1hFhsoCHFR4HdzqgH2pCUeoNYygg8nToYbtfTiy7OJaifXQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+4eseAFIqho+x88gsuzZcrCxqM5xdNp9B3fqXa3BxB0=; b=dyQVz31TPQX4bpPVwSqKDnbP64ObpqK3H7HifEVoyRt44EbYA+24Tq7+H2nAQ39sPf80XhvW/GhMplobQJ//SYEYovuUsiMvRupi1a37AetyzkDvU4WkdqPGhjV754KWv3xCLzATv5ri+Bn0oXw7dXy1W0gIz/u9E/1eZajabOo= 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 DB9PR08MB9804.eurprd08.prod.outlook.com (2603:10a6:10:45f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Fri, 28 Oct 2022 11:11:54 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7f57:1601:9b18:7529]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7f57:1601:9b18:7529%7]) with mapi id 15.20.5746.028; Fri, 28 Oct 2022 11:11:54 +0000 Message-ID: <014bddca-4700-3e24-6818-4248fcae182b@arm.com> Date: Fri, 28 Oct 2022 12:11:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] [AArch64] Fix pseudo-register numbering in the presence of unexpected additional registers Content-Language: en-US From: Luis Machado To: gdb-patches@sourceware.org References: <20220921175329.1005517-1-luis.machado@arm.com> <6cd56353-ce54-46f3-c985-641117cb6e41@arm.com> In-Reply-To: <6cd56353-ce54-46f3-c985-641117cb6e41@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SN4PR0501CA0059.namprd05.prod.outlook.com (2603:10b6:803:41::36) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DB9PR08MB9804:EE_|AM7EUR03FT003:EE_|AS8PR08MB7909:EE_ X-MS-Office365-Filtering-Correlation-Id: ebf6d7e2-1ef0-4ceb-cdb0-08dab8d53e3c 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: sTUxE68O9ueQ6pastsp//sRbIX/iz5ly4IE3MbqMD2SJJ/8u1OPL0Dyvw3oi9duDcZEHAHTQIirmvVQ3ezAhQylUQXckTF//3dbIV9MZPMdBsnpmCocBDSNglmauECMitkeBJwWJScFHy++8jQLQE57y/nD+RCAuAGhYL+OR86jrFvHzlJkLyMo/DLAgLKzoJHDCH7LDLRLWjmRl8YwQocwbchFE5aVnRb0NTCvl6iR1YyGRIvOENN/EmA1l+Xrd3qu1LWFPrLJoZzEDcPujdx93/PDZ+nMeH9qnYgqQXavvzyb73hNzJ5sxcBQVKCXCKIuFjan0tomRo7oYAQ1khf3w4e0vKNOjuz7C7/Cyfd0dxpKDDtEBblNC54TV7PWp7SuBZqkuGDwbZu6VOT/v3SkaNHBOe9FbvF0A/pGD3IcHYD7xWDRyh37z3QRebv3NcEA+LSe4NwkOwQiOourzVLHu9L94NLK8obqVx7b/WTaqlkScCLl+/S0mu3KABEOQ7JAyUhM2dwAUB+9jyFBaeQ7nblBdlAv+xrPPyIkSatsvrgVQnFJn6y6hjA7eiDV+Xs26sOP9GEDaxClboP2KUsJVO5xoiZnapyeAiTs3mggzrpEpa5M1tm0fzWb2ScodcigI8Njj1MNKNbelYWjME2VdpwV69kQ0VkTTYHeDklpqBybmokh9a5tcKLgJv71qfYqH+GJ+z/J59kkLgVJFe/OJxAVE7LO5BSUcjMSvPKqrrBojitf75Af6feFWiPT9BSCNqI5rHLmopPyEdmvYiSjuVYuXO4y75Nf1VxfWsbE= 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)(376002)(136003)(366004)(346002)(396003)(39860400002)(451199015)(6486002)(31686004)(6506007)(316002)(66946007)(53546011)(6666004)(66476007)(66556008)(6916009)(478600001)(8676002)(6512007)(38100700002)(5660300002)(86362001)(8936002)(44832011)(41300700001)(2616005)(186003)(2906002)(83380400001)(36756003)(31696002)(26005)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB9804 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: AM7EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: cb20597a-7905-4602-f6c0-08dab8d5387f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1v8dJ4JtJqRUhI//OJttUZrZR2zu89C/AxiKoybXeV2ZcbVoPZSJ7dhsjJV59I0pTleXbRGr86x4zjoeQZRRR/gMpLsmeT30nadKuEDRd8YP+6tBFhaZcpfsXvq+ktRjHZDqfOxbMaTgk/HLwvoJQyZKSK2AXSxl0KhDs688tbJLEn1GmJoHzGtPqRQd5q15I4tMHBu/QmQzazoXjb1MC4gKQc9k9UCJgbnG4x8nfb6r2E2y1cxQsxL0FX7TjHNn/BwkHioSvkGeZ2rINRrtC2fSKG9/wP749kqUijn3n/RqooBiC0Qkq2A+6ctvqFY3SaBZZameQ8aSiL7ESdK1PDPLM716Kvn6Xq/BpdzoEF0is3PuxUq3ZE+PjCzORVf5gJRJ2Ju6M+TOPtcKxWjKg3YCaAU9Hn9s0bnP2mX0jmniU3kip7XVO/GWQsTVfSR0aLE7hGtdpSiQR2qcG88FUxE4SH4m4p78s2qD41Q/P+xLstLyX6A2QSTBm9AHVyHfaoTtRfMzsftp3ORAG6pL/CejJYFJxfW41pE/9cKfLXsxECBYbrQa7kDAEtTxktB52ZhC6b0OSqpBnryocvECzZsC+OvLPS1RTRfD8rQGHtoZpKt/kqmLjJaJiBniH8FkNTT78GFBYkINkaelDEHozHxuUUxWxHMa7+JAemt/AUFUa/DhFaeiz+KJdXCdKvYPZDY5xD9m613x1vLvBuWncxok3GLTKHnCmEeB23BGvWtbxgt1c2tuB6eEsPfxzfDivTGCEtHU+HuVefWWT6qyG3RYVGZ6TM05hf4QPMwKHH4K5FGLHIFdFdkymWOQdbbr 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)(346002)(396003)(136003)(39860400002)(376002)(451199015)(36840700001)(40470700004)(46966006)(6512007)(31686004)(36756003)(36860700001)(31696002)(40460700003)(2616005)(336012)(83380400001)(44832011)(2906002)(81166007)(356005)(6666004)(47076005)(186003)(70586007)(6486002)(70206006)(26005)(53546011)(6916009)(86362001)(316002)(6506007)(478600001)(82740400003)(82310400005)(8936002)(5660300002)(8676002)(41300700001)(40480700001)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 11:12:03.7438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebf6d7e2-1ef0-4ceb-cdb0-08dab8d53e3c 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: AM7EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7909 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,BODY_8BITS,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 List-Id: Hi, On 10/3/22 14:16, Luis Machado wrote: > 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. I'd like to push this patch to both gdb 12 and gdb 11. Does that sound reasonable?