From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60088.outbound.protection.outlook.com [40.107.6.88]) by sourceware.org (Postfix) with ESMTPS id EA27D3858D3C; Tue, 3 May 2022 21:14:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA27D3858D3C ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=U8me/s2BOSZRCF8/Uzp/vWoJC77Z035NVHQgL+5kivj/jByYv1z0kYBabi8MlpE6kE8wZjWlnImxNd4j85u9n+1mJcJpmefg/xC78BMqjnU04qNXvewCnbxwVxGWBzAkluCtTyl58CibhRFT7+dtNThKMOUcWm6As75Ne2VlAgH8xfZn1ASv4F7y0gbTi52qDDNuBDygYxlaBcBXSwK8hdv3146FQ2Jtnyeuqz+1e0WAEapPk09kpT90VbZXwQIuN1hYgsgUujk5JPx1cxA4gCvIYs4iFX/q8+2bgDcZqvKiUtC2kLsMTepsk6u/y+y+M1yQUNy7QKUzpPXHSpIAqw== 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=NTfGM7f1YgcnIubNVIw9vCQ1dJmHLNfSdwWyUki+y7I=; b=ZCj9YnsxAgvrKyhHMTUCZd1/NgzyYnsLOulma8Fpu7kjFpxpxBlEdX9zaEn7S8X6pQ0klMLPIP27arBm7I9jb59nlAZIxJ7r3MYIenMyefXCqNgjHcANjH5f0wfHRKzNRMj05LswcwhhWCm+ZT7Skfpv9qwySVhbEKICnR75ZfGoxIqZtBEbW7WJTQbex4umW9TAzMvRekRm24cXcGKTB17zChXSJqQE0e0c5OkXYIXWv5rVfUPE/zAhDNBaOve7RBhwmaewcB+pyPrTfx/nxWpC9c4oU1QouwQ1WOAyss4W2UIJPxqRjseI/l5tGmJweWf3UvFUCoLAbs+wzA3Xlg== 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 DU2PR04CA0198.eurprd04.prod.outlook.com (2603:10a6:10:28d::23) by AM6PR08MB3176.eurprd08.prod.outlook.com (2603:10a6:209:46::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Tue, 3 May 2022 21:14:31 +0000 Received: from DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28d:cafe::c5) by DU2PR04CA0198.outlook.office365.com (2603:10a6:10:28d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24 via Frontend Transport; Tue, 3 May 2022 21:14:31 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT063.mail.protection.outlook.com (100.127.142.255) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.12 via Frontend Transport; Tue, 3 May 2022 21:14:31 +0000 Received: ("Tessian outbound 9613c00560a5:v118"); Tue, 03 May 2022 21:14:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1634cb4884087580 X-CR-MTA-TID: 64aa7808 Received: from 23d2a1dd4274.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 09359D1C-B692-42D8-8382-52E2C9F74880.1; Tue, 03 May 2022 21:14:25 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 23d2a1dd4274.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 May 2022 21:14:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2xHzjEK7qWpRYsDAHs3kue67Qr57u1NSR4pqQaGEL5Ag9xdA7rx+mWjvwYOs6DgaQr2sF3UkoPMpiamUZFa5J1kB3qn4xvCAkNDNHP14AARebjlImUJRyq9v0EYOFHEQDva7xGYnjFEOU9IpRnbzmAVHcjiSlBF3wCQnMYNEwV1NGz9psvJyNAyq5cvDb8L7vLiwNhDWeBto1ciig95U4IHg4PZLZXASRRB3JkCrXxGAgs6hzL7ZKBOiSaiA5f4rjzHTKwoH1cWUGob/s/3c3HWSXVYviYszm5rCQN5yGmb1NZHjl16aehom6JoziUPqcibYWLL96Y1C/Hl/oXe4A== 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=NTfGM7f1YgcnIubNVIw9vCQ1dJmHLNfSdwWyUki+y7I=; b=McnpCc1TFF+jKJTNMaRrkGG05xmSGw2+OVtzf5kQTUSAoXxMttatT6oGWzdX6JgJ9WEkEMeAmnGT/sG915hapWmGH3qoj+wLPkvPqawoX3ZF3WFYG3SJuc32ANdOTPjfmSciJRdCWezIQxMeEU5fauha0A8xAgXyq/M/wySqHeJI9KEcKGuXi7Fc4Qg50SgCUzJpZG06BWgXxy9BWqwJfh7uYhuaYdhPXLJJUta7zejh6FBDUZRWgJt29VPCsBedjmdmMBcqjIxO7RXO7UsSSw21Hb71vpZhYcqh5k6JOOO5H+dxS8u69jTxUKaXy/37/hazw581qfLd2qtWadHq4g== 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 AM6PR08MB3911.eurprd08.prod.outlook.com (2603:10a6:20b:80::27) by DB6PR0801MB1848.eurprd08.prod.outlook.com (2603:10a6:4:38::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Tue, 3 May 2022 21:14:22 +0000 Received: from AM6PR08MB3911.eurprd08.prod.outlook.com ([fe80::a8fb:37c7:214f:9cb4]) by AM6PR08MB3911.eurprd08.prod.outlook.com ([fe80::a8fb:37c7:214f:9cb4%4]) with mapi id 15.20.5206.024; Tue, 3 May 2022 21:14:22 +0000 Message-ID: Date: Tue, 3 May 2022 22:14:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 08/12] Add an aarch64-tls feature which includes the tpidr register. Content-Language: en-US To: John Baldwin , binutils@sourceware.org, gdb-patches@sourceware.org References: <20220323210048.25525-1-jhb@FreeBSD.org> <20220323210048.25525-9-jhb@FreeBSD.org> From: Luis Machado In-Reply-To: <20220323210048.25525-9-jhb@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LNXP265CA0033.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::21) To AM6PR08MB3911.eurprd08.prod.outlook.com (2603:10a6:20b:80::27) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: ba33b2b8-a4ef-4659-adcd-08da2d49ea28 X-MS-TrafficTypeDiagnostic: DB6PR0801MB1848:EE_|DBAEUR03FT063:EE_|AM6PR08MB3176:EE_ X-Microsoft-Antispam-PRVS: 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: FcXXVskEu7OlO91+5knET/yOxkV3o8lEmrwsyJzLmQB8xOBpvjj+XgEi7F/xq907H3TmnKSiLsLTCLeWZ2op9T57dhG2jyj4zxTgOIBgXxdcQDBJ4KgzyLSLNIsZUWJjpUnHoCRO/LgadFazMgQoToEdVBneyaEfif4eeWnyFfa+ISttXstQu/inQZNHgp3zWZIImQUR+gT+194Ar+Wf0m2Nr3a+Ta4frlXR+MgHS4Ah7JMJYwJ4SjQfO7MmXWs/fiwgewG7TegHjtLZFtos10W78KJSg0g1Pzw4/c68VHGOnThXEW8ZGYKCpEIaYMgA5K11vqF81cRgSDSDRX1LPXu/AN8MUi8g1RBduX8aI+1DoGdMSunmo1kgLbo27I14s6JjU9NlZy5ZuXzCzxhNuQC1AuSjJvG5HtPlYbLkvxQsccB8631p4cxbA/Q5mugdbrZa06BK0UJMcdpUYmPwCE7juJg0BQWdT+6xcJHW6MgWMuujbKr6JuYhHF9mpzXFKOJ8mRk62v17uxj3c2FuxDNrBcYV8mH6zB5qHwRZpy1Q5bWc0Q1Qhp2bWpXufG4BkYlXPDg/xVSAS17JOzWlI/CSEyc7x9r0zmrRQ4TaV7c7oJSllVR2GqAOefRgdm1p+DxUVwt+GNmdeqAf27pO8PKhU9ROmsUSVD59c2eswkVf3sgaVy8eJkPdHPCRBknES7pML3lcVozzmgJbPpWABKsOfS+YfKYO3vPP2lPvEjUFf+KKuu4+HRDMrf0dr6Txn0k7Q2tgBbeNy6WY/NxPwcdmkWCjznAsuKI6pYX29NU= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3911.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(53546011)(86362001)(31696002)(2906002)(6512007)(26005)(508600001)(38100700002)(8936002)(6486002)(36756003)(6666004)(30864003)(44832011)(5660300002)(8676002)(21480400003)(83380400001)(66556008)(66476007)(66946007)(31686004)(316002)(186003)(2616005)(2004002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1848 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: DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ed1ff5e0-9ce4-4eb4-783e-08da2d49e4b9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R//wGs3Rzut0rfzLMSX82XCHxhQpR0zDzk2oi300ugrx1qiBePBgqn7RILfv6f+0rGKjqLh6YhyjPT+5noAFRPyAv5QZrjD9fD6j94JtRDNz8as6hJc+1wxhxYF1YB6zgIemUKwGq95+LOqcba8OYfw7BS8t5IfSYyHzJLL30PL2Bn0uw4/Z1iQ+bInok+/QnIAApM/S+eRzddzK2HrKsCOHOMdBpwTUUAYiSwdNN1Jy8wxgiRcTRghUa3X/zz/vuKQsm3mE5aCkJJSLUGcfA/OwvOqlD6Y0094Qpg3VySjYYZeEr21FBFDzWQrsIGGrj6pTyKSGrBqQrILzOjNLsxoZPtKBJglleRILguma+vbYQ/9GSpizoastNRBruW/F4esdMudTCRfR/EH+5aZXWH4Mfm7i/TtP2WLp7UbB67kZefgudWU7e2ulBT3s5UvA0Vxx/AnV1kSp+wVMYs9Zd04O5Y4cYcsotr6JSlhX8vYRx8l67ITOPtlYwxV/+h9cfWuc6LCQevV3Bgu4DEwFe1Y9sDg10nTJjRq6yHEItXm013rtAoTg9/qNxHBQTzF0wbVFFH7YXWcLhSktYPy8TLdJYCtTXCLTDwyIlwj9VSrg0uwOAAB8X4U7gsLuu8IDX6hJTKimvKs3OaCB/C9eZ4nwOoXGbHggDI0uk7g4ggL5rxEBvlNEJ9aLFpW4Ur+q6m8okL03KkM0501dtAvDwN67J3c1rL3ktenUK/UFA0Q= 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(26005)(47076005)(83380400001)(21480400003)(356005)(2616005)(40460700003)(86362001)(36756003)(31686004)(53546011)(316002)(82310400005)(6512007)(31696002)(6506007)(336012)(5660300002)(81166007)(8936002)(508600001)(70586007)(70206006)(450100002)(2906002)(8676002)(6666004)(6486002)(44832011)(186003)(30864003)(36860700001)(2004002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2022 21:14:31.0587 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba33b2b8-a4ef-4659-adcd-08da2d49ea28 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: DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3176 X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2022 21:14:40 -0000 On 3/23/22 21:00, John Baldwin wrote: > --- > gdb/aarch64-linux-nat.c | 3 ++- > gdb/aarch64-linux-tdep.c | 2 +- > gdb/aarch64-tdep.c | 42 ++++++++++++++++++++++++++------ > gdb/aarch64-tdep.h | 10 +++++++- > gdb/arch/aarch64.c | 7 +++++- > gdb/arch/aarch64.h | 9 +++++-- > gdb/features/Makefile | 1 + > gdb/features/aarch64-tls.c | 14 +++++++++++ > gdb/features/aarch64-tls.xml | 12 +++++++++ > gdbserver/linux-aarch64-tdesc.cc | 2 +- > gdbserver/netbsd-aarch64-low.cc | 2 +- > 11 files changed, 88 insertions(+), 16 deletions(-) > create mode 100644 gdb/features/aarch64-tls.c > create mode 100644 gdb/features/aarch64-tls.xml > > diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c > index 7bb82d17cc8..4da274c285a 100644 > --- a/gdb/aarch64-linux-nat.c > +++ b/gdb/aarch64-linux-nat.c > @@ -646,7 +646,8 @@ aarch64_linux_nat_target::read_description () > bool pauth_p = hwcap & AARCH64_HWCAP_PACA; > bool mte_p = hwcap2 & HWCAP2_MTE; > > - return aarch64_read_description (aarch64_sve_get_vq (tid), pauth_p, mte_p); > + return aarch64_read_description (aarch64_sve_get_vq (tid), pauth_p, mte_p, > + false); > } > > /* Convert a native/host siginfo object, into/from the siginfo in the > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index cb132d5a540..f5aac7bc0b4 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -763,7 +763,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, > bool pauth_p = hwcap & AARCH64_HWCAP_PACA; > bool mte_p = hwcap2 & HWCAP2_MTE; > return aarch64_read_description (aarch64_linux_core_read_vq (gdbarch, abfd), > - pauth_p, mte_p); > + pauth_p, mte_p, false); > } > > /* Implementation of `gdbarch_stap_is_single_operand', as defined in > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index b714f6194b6..38c5c9e0e00 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -58,7 +58,7 @@ > #define HA_MAX_NUM_FLDS 4 > > /* All possible aarch64 target descriptors. */ > -static target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/][2 /* mte */]; > +static target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/][2 /* mte */][2 /* tls */]; > > /* The standard register names, and all the valid aliases for them. */ > static const struct > @@ -178,6 +178,12 @@ static const char *const aarch64_mte_register_names[] = > "tag_ctl" > }; > > +static const char *const aarch64_tls_register_names[] = > +{ > + /* Thread/Process ID Register. */ > + "tpidr" > +}; > + > /* AArch64 prologue cache structure. */ > struct aarch64_prologue_cache > { > @@ -3327,21 +3333,23 @@ aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch) > If VQ is zero then it is assumed SVE is not supported. > (It is not possible to set VQ to zero on an SVE system). > > - MTE_P indicates the presence of the Memory Tagging Extension feature. */ > + MTE_P indicates the presence of the Memory Tagging Extension feature. > + > + TLS_P indicates the presence of the Thread Local Storage feature. */ > > const target_desc * > -aarch64_read_description (uint64_t vq, bool pauth_p, bool mte_p) > +aarch64_read_description (uint64_t vq, bool pauth_p, bool mte_p, bool tls_p) > { > if (vq > AARCH64_MAX_SVE_VQ) > error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq, > AARCH64_MAX_SVE_VQ); > > - struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p][mte_p]; > + struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p][mte_p][tls_p]; > > if (tdesc == NULL) > { > - tdesc = aarch64_create_target_description (vq, pauth_p, mte_p); > - tdesc_aarch64_list[vq][pauth_p][mte_p] = tdesc; > + tdesc = aarch64_create_target_description (vq, pauth_p, mte_p, tls_p); > + tdesc_aarch64_list[vq][pauth_p][mte_p][tls_p] = tdesc; > } > > return tdesc; > @@ -3430,7 +3438,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > bool valid_p = true; > int i, num_regs = 0, num_pseudo_regs = 0; > int first_pauth_regnum = -1, pauth_ra_state_offset = -1; > - int first_mte_regnum = -1; > + int first_mte_regnum = -1, first_tls_regnum = -1; > > /* Use the vector length passed via the target info. Here -1 is used for no > SVE, and 0 is unset. If unset then use the vector length from the existing > @@ -3462,7 +3470,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > value. */ > const struct target_desc *tdesc = info.target_desc; > if (!tdesc_has_registers (tdesc) || vq != aarch64_get_tdesc_vq (tdesc)) > - tdesc = aarch64_read_description (vq, false, false); > + tdesc = aarch64_read_description (vq, false, false, false); > gdb_assert (tdesc); > > feature_core = tdesc_find_feature (tdesc,"org.gnu.gdb.aarch64.core"); > @@ -3471,6 +3479,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > feature_pauth = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.pauth"); > const struct tdesc_feature *feature_mte > = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.mte"); > + const struct tdesc_feature *feature_tls > + = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.tls"); > > if (feature_core == nullptr) > return nullptr; > @@ -3555,6 +3565,21 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > num_regs += i; > } > > + /* Add the TLS register. */ > + if (feature_tls != nullptr) > + { > + first_tls_regnum = num_regs; > + > + /* Validate the descriptor provides the mandatory MTE registers and > + allocate their numbers. */ > + for (i = 0; i < ARRAY_SIZE (aarch64_tls_register_names); i++) > + valid_p &= tdesc_numbered_register (feature_tls, tdesc_data.get (), > + first_tls_regnum + i, > + aarch64_tls_register_names[i]); > + > + num_regs += i; > + } > + > if (!valid_p) > return nullptr; > > @@ -3573,6 +3598,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > tdep->pauth_ra_state_regnum = (feature_pauth == NULL) ? -1 > : pauth_ra_state_offset + num_regs; > tdep->mte_reg_base = first_mte_regnum; > + tdep->tls_reg_base = first_tls_regnum; > > set_gdbarch_push_dummy_call (gdbarch, aarch64_push_dummy_call); > set_gdbarch_frame_align (gdbarch, aarch64_frame_align); > diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h > index 60a9d5a29c2..092586d4ee3 100644 > --- a/gdb/aarch64-tdep.h > +++ b/gdb/aarch64-tdep.h > @@ -111,10 +111,18 @@ struct aarch64_gdbarch_tdep : gdbarch_tdep > { > return mte_reg_base != -1; > } > + > + /* TLS register. This is -1 if the TLS register is not available. */ > + int tls_reg_base = 0; > + > + bool has_tls() const > + { > + return tls_reg_base != -1; > + } > }; > > const target_desc *aarch64_read_description (uint64_t vq, bool pauth_p, > - bool mte_p); > + bool mte_p, bool tls_p); > > extern int aarch64_process_record (struct gdbarch *gdbarch, > struct regcache *regcache, CORE_ADDR addr); > diff --git a/gdb/arch/aarch64.c b/gdb/arch/aarch64.c > index 485d667ccde..733a3fd6d2a 100644 > --- a/gdb/arch/aarch64.c > +++ b/gdb/arch/aarch64.c > @@ -24,11 +24,13 @@ > #include "../features/aarch64-sve.c" > #include "../features/aarch64-pauth.c" > #include "../features/aarch64-mte.c" > +#include "../features/aarch64-tls.c" > > /* See arch/aarch64.h. */ > > target_desc * > -aarch64_create_target_description (uint64_t vq, bool pauth_p, bool mte_p) > +aarch64_create_target_description (uint64_t vq, bool pauth_p, bool mte_p, > + bool tls_p) > { > target_desc_up tdesc = allocate_target_description (); > > @@ -52,5 +54,8 @@ aarch64_create_target_description (uint64_t vq, bool pauth_p, bool mte_p) > if (mte_p) > regnum = create_feature_aarch64_mte (tdesc.get (), regnum); > > + if (tls_p) > + regnum = create_feature_aarch64_tls (tdesc.get (), regnum); > + > return tdesc.release (); > } > diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h > index e416e346e9a..79821666ce6 100644 > --- a/gdb/arch/aarch64.h > +++ b/gdb/arch/aarch64.h > @@ -29,6 +29,7 @@ struct aarch64_features > bool sve = false; > bool pauth = false; > bool mte = false; > + bool tls = false; > }; > > /* Create the aarch64 target description. A non zero VQ value indicates both > @@ -36,10 +37,12 @@ struct aarch64_features > an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH > feature. > > - MTE_P indicates the presence of the Memory Tagging Extension feature. */ > + MTE_P indicates the presence of the Memory Tagging Extension feature. > + > + TLS_P indicates the presence of the Thread Local Storage feature. */ > > target_desc *aarch64_create_target_description (uint64_t vq, bool has_pauth_p, > - bool mte_p); > + bool mte_p, bool tls_p); > > /* Register numbers of various important registers. > Note that on SVE, the Z registers reuse the V register numbers and the V > @@ -84,6 +87,8 @@ enum aarch64_regnum > #define AARCH64_PAUTH_CMASK_REGNUM(pauth_reg_base) (pauth_reg_base + 1) > #define AARCH64_PAUTH_REGS_SIZE (16) > > +#define AARCH64_TPIDR_REGNUM(tls_reg_base) (tls_reg_base) > + > #define AARCH64_X_REGS_NUM 31 > #define AARCH64_V_REGS_NUM 32 > #define AARCH64_SVE_Z_REGS_NUM AARCH64_V_REGS_NUM > diff --git a/gdb/features/Makefile b/gdb/features/Makefile > index 4b09819389a..946ec983df5 100644 > --- a/gdb/features/Makefile > +++ b/gdb/features/Makefile > @@ -198,6 +198,7 @@ FEATURE_XMLFILES = aarch64-core.xml \ > aarch64-fpu.xml \ > aarch64-pauth.xml \ > aarch64-mte.xml \ > + aarch64-tls.xml \ > arc/v1-core.xml \ > arc/v1-aux.xml \ > arc/v2-core.xml \ > diff --git a/gdb/features/aarch64-tls.c b/gdb/features/aarch64-tls.c > new file mode 100644 > index 00000000000..30d730dffba > --- /dev/null > +++ b/gdb/features/aarch64-tls.c > @@ -0,0 +1,14 @@ > +/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: > + Original: aarch64-tls.xml */ > + > +#include "gdbsupport/tdesc.h" > + > +static int > +create_feature_aarch64_tls (struct target_desc *result, long regnum) > +{ > + struct tdesc_feature *feature; > + > + feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.tls"); > + tdesc_create_reg (feature, "tpidr", regnum++, 1, NULL, 64, "data_ptr"); > + return regnum; > +} > diff --git a/gdb/features/aarch64-tls.xml b/gdb/features/aarch64-tls.xml > new file mode 100644 > index 00000000000..48e0e9a6030 > --- /dev/null > +++ b/gdb/features/aarch64-tls.xml > @@ -0,0 +1,12 @@ > + > + > + > + > + > + > + > diff --git a/gdbserver/linux-aarch64-tdesc.cc b/gdbserver/linux-aarch64-tdesc.cc > index e982ab85067..14d6a4f80eb 100644 > --- a/gdbserver/linux-aarch64-tdesc.cc > +++ b/gdbserver/linux-aarch64-tdesc.cc > @@ -42,7 +42,7 @@ aarch64_linux_read_description (uint64_t vq, bool pauth_p, bool mte_p) > > if (tdesc == NULL) > { > - tdesc = aarch64_create_target_description (vq, pauth_p, mte_p); > + tdesc = aarch64_create_target_description (vq, pauth_p, mte_p, false); > > static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL }; > static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc", > diff --git a/gdbserver/netbsd-aarch64-low.cc b/gdbserver/netbsd-aarch64-low.cc > index 202bf1cdac6..b371e599232 100644 > --- a/gdbserver/netbsd-aarch64-low.cc > +++ b/gdbserver/netbsd-aarch64-low.cc > @@ -96,7 +96,7 @@ void > netbsd_aarch64_target::low_arch_setup () > { > target_desc *tdesc > - = aarch64_create_target_description (0, false); > + = aarch64_create_target_description (0, false, false, false); > > static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL }; > init_target_desc (tdesc, expedite_regs_aarch64); LGTM from aarch64's side.