From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2075.outbound.protection.outlook.com [40.107.8.75]) by sourceware.org (Postfix) with ESMTPS id 6984A3858C5E for ; Mon, 24 Jul 2023 16:27:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6984A3858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=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=Y0OI7iBJEDLaa+K+lxMZ4fGW70GzhkOsdPKTO+rGt1I=; b=1xpdivKlH07bub8TXn3l1/1r0Zy9rHbVHF/PDdNcC4opPaG8nix07N+aK7PT0J95WbNfs0YAFRkOT1zNW/gkauzACHoTBoOC5eZAUHRRwe4CRz4/YATL8T2qdP/hbLQXV9aqQ4pVlo/x+huuF6UjIBjzDo/9BrJp196+mnta+8c= Received: from DB8PR06CA0053.eurprd06.prod.outlook.com (2603:10a6:10:120::27) by DBBPR08MB5995.eurprd08.prod.outlook.com (2603:10a6:10:20b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Mon, 24 Jul 2023 16:26:56 +0000 Received: from DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::4b) by DB8PR06CA0053.outlook.office365.com (2603:10a6:10:120::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32 via Frontend Transport; Mon, 24 Jul 2023 16:26:56 +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 DBAEUR03FT061.mail.protection.outlook.com (100.127.143.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.24 via Frontend Transport; Mon, 24 Jul 2023 16:26:56 +0000 Received: ("Tessian outbound e1fdbe8a48d3:v145"); Mon, 24 Jul 2023 16:26:56 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8862ec5399f6f00c X-CR-MTA-TID: 64aa7808 Received: from f98d0af6b514.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0958BB9A-4A35-4177-B550-319F129F256A.1; Mon, 24 Jul 2023 16:26:49 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f98d0af6b514.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 24 Jul 2023 16:26:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BrkGtbQxE17d5pNT2kst3Do/myoJtILFa38OppC5Q3IdaW0cTUUli+U6JqqBgiRZPeLq53mDpoBLx0axbeF/IoPk5NhV0J3CKuCgzHGV30yDMrby/js+1qi2VGozIkOm+pJGyuv5yRJi/sBzpjplHC0yVltpqup+15d43keSsV2Jn8yp4wkwy3/mne8ndMkSREVJuPYnOi+ZupHWOxggKOEZ6BAwhV9PfDUaqjP06je22dxbwQM7LXwV8sI1CcR8W2vKEeyouWpB47Omxpa3ehp6gLu1VgA3Wj/f2k5OUdOS2KcGa0SzJGvGnnMGtRPqsYeDzvk9e2fM3UIajs20JQ== 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=Y0OI7iBJEDLaa+K+lxMZ4fGW70GzhkOsdPKTO+rGt1I=; b=dkkj3Q78pebhbIQxcL23uL55B3s7JuWVKHMWV2dzYptVDOP0Q6D/iBTLg/INRjt1B31rKwiCRAFillPOs41J47sXuOw+Yalulcs0W1fKdBwsr4syPx2HkSU6PQ+DuaVv/L7C8auqxSYQc+n3y86h7uclMvUh9KVX+w7JLA7ztEQtzLHjb5CsW2y32422eoKp7UBct8n0htOCIa7txgvQrqPJAd4ftBycK5EkO0U3enVu9cuTNDzujnBf+acVEe8cmpXkc7J+yhFBOLtw3rFGD5bNgzJEqgpmihV1/QFaYYBxW8o1i6pE9kMiQUASpIKPWO6a4eojWWKSCz9Fk7L7DA== 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=Y0OI7iBJEDLaa+K+lxMZ4fGW70GzhkOsdPKTO+rGt1I=; b=1xpdivKlH07bub8TXn3l1/1r0Zy9rHbVHF/PDdNcC4opPaG8nix07N+aK7PT0J95WbNfs0YAFRkOT1zNW/gkauzACHoTBoOC5eZAUHRRwe4CRz4/YATL8T2qdP/hbLQXV9aqQ4pVlo/x+huuF6UjIBjzDo/9BrJp196+mnta+8c= 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 GV1PR08MB7730.eurprd08.prod.outlook.com (2603:10a6:150:51::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Mon, 24 Jul 2023 16:26:41 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::8a62:27dd:fe3c:cefd]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::8a62:27dd:fe3c:cefd%7]) with mapi id 15.20.6609.031; Mon, 24 Jul 2023 16:26:40 +0000 Message-ID: <5f63fb04-32c3-e5fe-445e-709c4cdc4f35@arm.com> Date: Mon, 24 Jul 2023 17:26:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3 01/16] [gdb/aarch64] Fix register fetch/store order for native AArch64 Linux Content-Language: en-US To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org References: <20230630134616.1238105-1-luis.machado@arm.com> <20230630134616.1238105-2-luis.machado@arm.com> <87ila9jofh.fsf@linaro.org> From: Luis Machado In-Reply-To: <87ila9jofh.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN7P220CA0019.NAMP220.PROD.OUTLOOK.COM (2603:10b6:806:123::24) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|GV1PR08MB7730:EE_|DBAEUR03FT061:EE_|DBBPR08MB5995:EE_ X-MS-Office365-Filtering-Correlation-Id: e67c5df7-ac24-4c57-f7a4-08db8c62cc3f 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: W0NHlKx47/NnJhzsw8DyC7LZ5GW03UDEVR46A2Iw3zEJDUpbqCPBLwBRZ0L8OyNlLEaghU4ZPq8R8lDRc4qUbmsfBFa3DF2Wo42jD4SirZw2xOxEiMxfXFjUuAp98mkNN5lYCFjkcysHyNs9s6BnAnstpEqedBkNQDRHc6B+LqHbwGAOyNMIi7mgmGf4ElFIOtjGrnu8E1sAxl4VNy/MkCxKHZ9GiAggwSb5ty8qaeUbjWglVvFe7cWDNxc8Z3VndGeFL2+XCUk89WsatOCfZ06oPZWmjCJTWnBLoVkj2Pv9/gYUa7qvnKSyP4pmsd1WStHjxXasjvbvYGiMmg09SPDhxoU9UAyqK3b6xqKTdKHCxGK+jQtrohhdZUvwklrQum9RC4PNApoEUKRmUTUAqbkcW3AdXFQvDT8XBIzfRqTMQ1iPMfs+dEtK+PtqGNEIKJUuNckTK6ACAfNZUUSbA820E70XaExbew/9nCrynLWu6vYpQQsJsVmiaN6qpesdriJzUdDCeUm0bNKFg9No0HhBeBUCkwnk2KUY2X9nFuGNxs4v+mU3mYWPU0cskjDW96JmsTK24n6zGWXgEu1wxxwUvsitu3LjnGPMF4a64aBxH3pMM8DnHAve3LMuInUwE0tq9jri1HPFJTjjoTxaUA== 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:(13230028)(4636009)(136003)(376002)(366004)(39860400002)(346002)(396003)(451199021)(6486002)(6512007)(6666004)(478600001)(2616005)(53546011)(186003)(6506007)(26005)(2906002)(44832011)(6916009)(41300700001)(66556008)(66476007)(4326008)(5660300002)(8676002)(8936002)(66946007)(316002)(38100700002)(36756003)(86362001)(31696002)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB7730 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: DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9c580516-ef7e-43e3-30a5-08db8c62c22f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1gnBVkqkWbd35tyi3P/ghGfZ+iT1WoLFZsS44wSNLOfuextO0sXUc5f+Ai3Fhvc5rvBpNtIWnXijocFOGmXZ3mhLkE81HuD26Wx2xJ9Y0mCNEP6lJB3oA8vXyMLrCTiTfIvO5VNrdxIuWSB8b8m2MiGX0HdAbTf3T7TVfAjrIJtnNj+3qlJ1DcN15iK9bIzXLvUBVgXnbRJZ77vYKCtS+A6d572zizBGk6roTBFQk6jvUp4K8XpxpOlq17+36VOkPjLYFJ4PfbM4GzAOY6VoCg/CLkCu+AROImbgnMezJzVY8i9jE7XqSQ9mZq9XrP72KBomXs2h3AkeUBxhNvFQaBazYV59tRFF7yu7lXslxvYQQo7Iw+fVzyn6DzFJcdNizx39vGzkWlEL4AqHP6UEiVzITKSPGjxbkuYMz7NvccP5wxnY1SUXCYuwifR8rL8jMK1GOPEHp3FGQkECpxAKzCeWTzUliJPeirJJ51KnuymOn4nlJxfJ22DoPZCBdxqdk2N+dgeqGvoaQQoy7BW9LMYP+na+My9uQEzOPzvlA7H1igXn6hijqUHpqeRCpxL6qtH7LT2awLtzU0AL8/5WWwUb4Bj2vSjBaDC6rc+mN0Q5L2SWNPcoP6TJiZLlThGi0Z/byHmeX5bOmPjLgqLrZoWtryY8b1ZFcpClnKgJTp+kVMYyyfRLj69k2oT6clgD4J4Q/bNPjsLA3TZa44ZtSYl1yRrzC/13TXBUTtIn1G8yuLlb9JEhNWmv87w5T/+1oVGqmMa5i60GH0THJjhJsA== 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)(136003)(39860400002)(376002)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(36756003)(2616005)(2906002)(36860700001)(47076005)(41300700001)(336012)(44832011)(26005)(5660300002)(40480700001)(6506007)(53546011)(8936002)(8676002)(6862004)(40460700003)(186003)(6666004)(31696002)(356005)(82740400003)(81166007)(70206006)(70586007)(86362001)(6486002)(478600001)(31686004)(6512007)(316002)(4326008)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2023 16:26:56.4328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e67c5df7-ac24-4c57-f7a4-08db8c62cc3f 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: DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5995 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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 7/24/23 16:53, Thiago Jung Bauermann wrote: > > Hello Luis, > > I'm (slowly) going through your patches. I only found a few small nits > so far. Thanks! That will be very helpful. > > Luis Machado via Gdb-patches writes: > >> @@ -521,28 +522,28 @@ aarch64_fetch_registers (struct regcache *regcache, int regno) >> if (tdep->has_tls ()) >> fetch_tlsregs_from_thread (regcache); >> } >> + /* General purpose register? */ >> else if (regno < AARCH64_V0_REGNUM) >> fetch_gregs_from_thread (regcache); >> - else if (tdep->has_sve ()) >> + /* SVE register? */ >> + else if (tdep->has_sve () && regno <= AARCH64_SVE_VG_REGNUM) >> fetch_sveregs_from_thread (regcache); >> - else >> + /* FPSIMD register? */ >> + else if (regno < AARCH64_FPCR_REGNUM) > > fetch_fpregs_from_thread reads AARCH64_FPCR_REGNUM, so shouldn't the if > condition above use '<='? > > Ditto for aarch64_store_registers further below. > Yes, this does look like a mistake when reworking this code. >> fetch_fpregs_from_thread (regcache); >> - >> - if (tdep->has_pauth ()) >> - { >> - if (regno == AARCH64_PAUTH_DMASK_REGNUM (tdep->pauth_reg_base) >> - || regno == AARCH64_PAUTH_CMASK_REGNUM (tdep->pauth_reg_base)) >> - fetch_pauth_masks_from_thread (regcache); >> - } >> - >> - /* Fetch individual MTE registers. */ >> - if (tdep->has_mte () >> - && (regno == tdep->mte_reg_base)) >> + /* PAuth register? */ >> + else if (tdep->has_pauth () >> + && (regno == AARCH64_PAUTH_DMASK_REGNUM (tdep->pauth_reg_base) >> + || regno == AARCH64_PAUTH_CMASK_REGNUM (tdep->pauth_reg_base))) >> + fetch_pauth_masks_from_thread (regcache); >> + /* MTE register? */ >> + else if (tdep->has_mte () >> + && (regno == tdep->mte_reg_base)) >> fetch_mteregs_from_thread (regcache); >> - >> - if (tdep->has_tls () >> - && regno >= tdep->tls_regnum_base >> - && regno < tdep->tls_regnum_base + tdep->tls_register_count) >> + /* TLS register? */ >> + else if (tdep->has_tls () >> + && regno >= tdep->tls_regnum_base >> + && regno < tdep->tls_regnum_base + tdep->tls_register_count) >> fetch_tlsregs_from_thread (regcache); >> } >> >> @@ -592,6 +593,7 @@ aarch64_store_registers (struct regcache *regcache, int regno) >> aarch64_gdbarch_tdep *tdep >> = gdbarch_tdep (regcache->arch ()); >> >> + /* Do we need to store all registers? */ >> if (regno == -1) >> { >> store_gregs_to_thread (regcache); >> @@ -606,22 +608,26 @@ aarch64_store_registers (struct regcache *regcache, int regno) >> if (tdep->has_tls ()) >> store_tlsregs_to_thread (regcache); >> } >> + /* General purpose register? */ >> else if (regno < AARCH64_V0_REGNUM) >> store_gregs_to_thread (regcache); >> - else if (tdep->has_sve ()) >> + /* SVE register? */ >> + else if (tdep->has_sve () && regno <= AARCH64_SVE_VG_REGNUM) >> store_sveregs_to_thread (regcache); >> - else >> + /* FPSIMD register? */ >> + else if (regno < AARCH64_FPCR_REGNUM) > > Shouldn't it be "regno <= AARCH64_FPCR_REGNUM" here? > Yes. I'll fix those up. Thanks for spotting those. >> store_fpregs_to_thread (regcache); >> - >> - /* Store MTE registers. */ >> - if (tdep->has_mte () >> - && (regno == tdep->mte_reg_base)) >> + /* MTE register? */ >> + else if (tdep->has_mte () >> + && (regno == tdep->mte_reg_base)) >> store_mteregs_to_thread (regcache); >> - >> - if (tdep->has_tls () >> - && regno >= tdep->tls_regnum_base >> - && regno < tdep->tls_regnum_base + tdep->tls_register_count) >> + /* TLS register? */ >> + else if (tdep->has_tls () >> + && regno >= tdep->tls_regnum_base >> + && regno < tdep->tls_regnum_base + tdep->tls_register_count) >> store_tlsregs_to_thread (regcache); >> + >> + /* PAuth registers are read-only. */ >> } >> >> /* A version of the "store_registers" target_ops method used when running >