From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2045.outbound.protection.outlook.com [40.107.20.45]) by sourceware.org (Postfix) with ESMTPS id 6D4A7388CE97 for ; Wed, 8 Jun 2022 13:31:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D4A7388CE97 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=b8iVb2thZ13x36hft2VtBqfAS8M0Cd+b7LT6JRpiZIIMnJuu1qZ6tpLnKb60q/G8n5PpzQutjZGjm373SZD9uvpFkLpHVmimjbIwrOJCHXtNdCVPSWxdijgOH51WEedTukGA/BbTeVBzyuevh7YHB7PmGcpo4ym2795yqssc4VySZQkqnWyLKZZtdZzeKIIhYk6afucZDyFafw69BxU9gMHgn1XXCZ1OaDM3K3ax1Y2e45I9QUvhlj/BfGxGGr2X1luWxkL/uijJcDw9x72DrIUeEIHx2+G0exOTrGhfVCoh/I8vsjRYlyhLhYZP2SKVl9BvMpT5vTOfKqUpkh9yKw== 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=Bse1mGZbUA50x0KSGXxUZGak07i+B8nfI+laA/tLAXk=; b=TIAtyDHQe2KyN4Eegl6XbwCIvB+5pyO7K+oTMVU+XJKb55rNCjtnCJ7ALvg4XdXLPwr6R28cU86GnJx5CERk+KgIt7aTdt+9cgMN9ze5CKN8m5zpGeQkno+fda9cNKOFqkZqClm4IBh1xUf8RLG2oby9BE2x8gdNAoq1pgOUNZGCfO7ZoOUfWz05IphPrkmp6zAitjbA5mzLkFt8QwvU9r6EauzTPc8NOipArDbRefa/nl1vLtuYCfx0NP7WGqFW8FM8ovm3cdLvAyztSX03c8pE6daiczkn3zTQ2Y80R+m7JTTGsswLKXj4H04LJpmLuFKNFBy2BvROnzdbxpsnZw== 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 DU2PR04CA0002.eurprd04.prod.outlook.com (2603:10a6:10:3b::7) by DB8PR08MB5083.eurprd08.prod.outlook.com (2603:10a6:10:e9::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Wed, 8 Jun 2022 13:31:24 +0000 Received: from DBAEUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:3b:cafe::48) by DU2PR04CA0002.outlook.office365.com (2603:10a6:10:3b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12 via Frontend Transport; Wed, 8 Jun 2022 13:31:24 +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 DBAEUR03FT033.mail.protection.outlook.com (100.127.142.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12 via Frontend Transport; Wed, 8 Jun 2022 13:31:23 +0000 Received: ("Tessian outbound 1766a3bff204:v120"); Wed, 08 Jun 2022 13:31:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9c9b9a675061cea9 X-CR-MTA-TID: 64aa7808 Received: from 309829eb3de8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D0920AFC-5E52-4606-9FD6-E1A68159C4B5.1; Wed, 08 Jun 2022 13:31:12 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 309829eb3de8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Jun 2022 13:31:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GJ5/CuH/ck8CO64smtpiFvB5PzvRxScnUyj4zILfzMVXePgnkqWdb034Veh6bY8AEpF8f08RLQI9vdci4SswMfode+cO4ycuF54LPhVFAdP7u6M4UTbpib+SeHDzmsTrk8xuofnDqw2lVhwyjZLYLWaxOkUfUEDXQ2qWitWQbR9g4Pf9Abmx3niQmxdu46coh+jjlVgwkZMI2tjLZYOyUCMUTaNZ2xbUUxDjTKRXRfTxa8NZutK5U1zlhuoe6t1i1t2eb4qLBRYUv00g2++fxXWSr0OFgjtPSCMyRDaWxGc41QbI6wEcRX+Rw8/lq5AP49JWrhfKRCPNeg2tbaLLAQ== 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=Bse1mGZbUA50x0KSGXxUZGak07i+B8nfI+laA/tLAXk=; b=dsxZPLSTSUaUGKrTW7QjW1jrqYt6jPGALsLAnxJe4JdjB+5xf0QU9XgE5pfBD9Z3Xsg8+xuf/sNutcoQvKGCSXpjZC7iuUZh/ckG6NEhcTM7g7+MkV4Ylpf3QWSi4TpYvVsx6a03aWgyYTRmYoFTjjXK7O5Lb5a2vkFgV7wHOj6eyxUITDr9nuTWreSwT0DJyZOAHvFT+Jk6lLM9l6xlyy2+ciyj2n4grwOh7VmCbfzPAKxqXHeZjWyrYLEnpOZCAoS6ThnlwoECrwk28mpx1C3wt1szybKAJxBFiIFPSJvnN3CI49YUb35eTEy54flEoDOgsL8A7jXs3yqWPOQiwg== 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 VE1PR08MB5773.eurprd08.prod.outlook.com (2603:10a6:800:1a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Wed, 8 Jun 2022 13:31:09 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::9545:ff73:df89:3e50]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::9545:ff73:df89:3e50%7]) with mapi id 15.20.5314.019; Wed, 8 Jun 2022 13:31:09 +0000 Message-ID: <0a6b1f5a-a8d7-7226-e99e-7ec9f3347f1e@arm.com> Date: Wed, 8 Jun 2022 14:31:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] gdb/arm: Document and fix exception stack offsets Content-Language: en-US To: Yvan Roux , gdb-patches@sourceware.org Cc: Christophe Lyon , Torbjorn SVENSSON References: <20220602092316.GB20273@gnbcxd0114.gnb.st.com> <20220602142948.GC23363@gnbcxd0114.gnb.st.com> From: Luis Machado In-Reply-To: <20220602142948.GC23363@gnbcxd0114.gnb.st.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0353.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::29) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 455517b1-ab35-44cc-f351-08da49532e63 X-MS-TrafficTypeDiagnostic: VE1PR08MB5773:EE_|DBAEUR03FT033:EE_|DB8PR08MB5083: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: X+UpiTGTGDVybFt50TObU+Z9mD65m9leRkFxNuxG/VkOUQMBZoJsZRGrMis0QBkWvGOUq9K/lhimk+0fOnnMMHKtIIcFd5k7auhV1eZtacEtD1ONq0Peybc3t1amRso0I13V1nsgq+kw/QkT3L8UqBg1MwkkQDkEkE12/EHvwSNyZRzvi2aIDlMLevTFyIocBqfTRcEgHF0bcdnHLL5nYiH33nHQ5oRpa8szlnzTxb4k1+zoYMOhYTys7IscAmFIRqExa7p4A9hGgA8Ea8rMtO0CbSisrjr8klVdwg7QZOlz6P7xKFqeVy7esRYQKcOhn4h7iXu2M5pcRoFKtPkunkAvexWZCcXEwO+v0VjousdHE0IBprZd7ZMz/qnUBJX78B65Z6O265E1uC+Klp8i5weKeLRlJ8uim6UdkiN5l3rcl3b5chptLoPHAXIm6sHSh/CPQcfKgqVS2EplW1PavY3kWOr4jjyPUsCDRrmVIqsnRI6C0zR2eeC74n/h89VBJg14oQrlrxTzEZ36iaH1abYip8U8cCkFtbNPapwM9Zj7KfRhU2vlNK+k6gIb1q/oOmJ0hpCF2dnW5UBUTDaT8Ri8Qfm7Vc8xBVaXsTlXwEe3d1BNxek4cUcBNTxmUmrb6G/oPdRH/iXgyc2tynUkkT8RNP/5NQZFFl6KxC2Mk1aoyDDsGqOqpgybV9QtnJz0rWbiHhv964/HxoisPvWxZrn7vdgrw5+qVt0sx46RsnE= 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:(13230001)(4636009)(366004)(66556008)(66476007)(44832011)(8936002)(31686004)(66946007)(5660300002)(2616005)(54906003)(316002)(8676002)(4326008)(86362001)(31696002)(2906002)(6486002)(83380400001)(508600001)(38100700002)(53546011)(6512007)(6506007)(26005)(6666004)(186003)(36756003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5773 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: DBAEUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9867f85b-1258-4e06-a113-08da495325ad X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7s7M8heEqcG7iFQ5DPfUa8Rg6mngj9hm44ulyrh10I0Xgc5NYw6LHQXti/NrWOx3PtHOo2HoKmln2BFqsPsuROTxVHJR+2aX8KZgAF2JzoKc++Ro3bE/SYW9lPQAEoFrdVmpyJll5z3myPhy7/8WoWBsQ8fwEN83qNTkrafe7N6yV9Yn2XbBUvv9MQIUcrh8LzXnThBSAD0h6IBEmIQDRaMtdo/pcRi6M6hfe3FN2o9VB/qlYZPePqtdvTrgXcxkV3pcB144Dep6CDqZPt+Q0BQjQB3qb88rT8Jc9ImcFAPXOgX+RNd9thjoEv1Yy8eFdXu7weMoNAvOEQ4wcs8opWT8KUuJxz1ljlY9c/hmM0v/otkv0TBzp2nOTo2LnvYl3QVa9+w+rPbMYGTC5SgK9B2BrQ0YMRv0qRsLoEif94Y3/HMscCJDBNVtySjHaFCgtiKAe85bB1ig2tTQ36KPI5epNK+gBoYmXA27qKSGEx1jX26UUEKzPQsah7b8Kwf62mOmQIG1runL1QLMpb0DlG6mT268fdcOwlL1ki975XZPazb7cc9vE0uvOgs799eAHCSR1bHYlhfipNbfmEgLEdwTOU07TwflmKj6ZkvozdY7bbOD/29Tf1T7Tl/iK26oe1w5QzD+deCcbRupSZDRW0Z2j2kD+HNwQ7pZv/0b0h6cMnRIgxfjKhWQLNYPhG+2+czoitxP2X24Z+7PbV15Tg== 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)(36840700001)(40470700004)(46966006)(6486002)(36756003)(8676002)(4326008)(31696002)(186003)(336012)(6666004)(316002)(86362001)(31686004)(54906003)(8936002)(53546011)(70206006)(508600001)(5660300002)(83380400001)(70586007)(44832011)(82310400005)(81166007)(47076005)(40460700003)(36860700001)(2906002)(6512007)(26005)(356005)(6506007)(2616005)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2022 13:31:23.5605 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 455517b1-ab35-44cc-f351-08da49532e63 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: DBAEUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5083 X-Spam-Status: No, score=-13.2 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, T_SCC_BODY_TEXT_LINE, 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: Wed, 08 Jun 2022 13:31:31 -0000 On 6/2/22 15:29, Yvan Roux wrote: > On Thu, Jun 02, 2022 at 12:09:47PM +0200, Christophe Lyon wrote: >> >> >> On 6/2/22 11:23, Yvan Roux via Gdb-patches wrote: >>> Hi, >>> >>> Add a description of exception entry context stacking and fix next >>> frame offset (at 0xA8 relative to R0 location) as well as FPU >>> registers ones (starting at 0x68 relative to R0). >> >> Thanks, adding the picture will really help maintenance! >> So IIUC, the existing code is broken when there is no Secure->Non-Secure >> transition additional context saved? > > Thanks, yes that's it, the current offsets assume that the additional contexts > are present. > >> >>> >>> Signed-off-by: Torbj�rn SVENSSON >>> Signed-off-by: Yvan Roux >>> --- >>> gdb/arm-tdep.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++---- >>> 1 file changed, 58 insertions(+), 4 deletions(-) >>> >>> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c >>> index 50ec41a66b1..759dfd76ef6 100644 >>> --- a/gdb/arm-tdep.c >>> +++ b/gdb/arm-tdep.c >>> @@ -3417,6 +3417,57 @@ arm_m_exception_cache (struct frame_info *this_frame) >>> /* Fetch the SP to use for this frame. */ >>> unwound_sp = arm_cache_get_prev_sp_value (cache, tdep); >>> + /* Exception entry context stacking as described into ARMv8-M (section B3.19) >>> + and ARMv7-M (sections B1.5.6 and B1.5.7) Architecture Reference Manuals. >>> + >>> + SP Offsets >>> + Without With >>> + Callee Regs Callee Regs >> >> Could make the description here (Without Callee Regs) a more obvious match >> of the one below (Additional State Ctx When transitioning from Secure to >> Non-secure)? > > OK > >>> + >>> + +-------------------+ >>> + 0xA8 | | 0xD0 >>> + +===================+ --+ <-- Original SP >>> + 0xA4 | S31 | 0xCC | >>> + +-------------------+ | >>> + ... | Additional FP Ctx >> Here and elsewhere, I suggest Ctx -> Context > > OK > >>> + +-------------------+ | >>> + 0x68 | S16 | 0x90 | >>> + +===================+ --+ >>> + 0x64 | Reserved | 0x8C | >>> + +-------------------+ | >>> + 0x60 | FPSCR | 0x88 | >>> + +-------------------+ | >>> + 0x5C | S15 | 0x84 | FP Ctx >>> + +-------------------+ | >>> + ... | >>> + +-------------------+ | >>> + 0x20 | S0 | 0x48 | >>> + +===================+ --+ >>> + 0x1C | xPSR | 0x44 | >>> + +-------------------+ | >>> + 0x18 | Return address | 0x40 | >>> + +-------------------+ | >>> + 0x14 | LR(R14) | 0x3C | >>> + +-------------------+ | >>> + 0x10 | R12 | 0x38 | State Ctx >>> + +-------------------+ | >>> + 0x0C | R3 | 0x34 | >>> + +-------------------+ | >>> + ... | >>> + +-------------------+ | >>> + 0x00 | R0 | 0x28 | >>> + +===================+ --+ >>> + | R11 | 0x24 | >>> + +-------------------+ | >>> + ... | >>> + +-------------------+ | Additional State Ctx >>> + | R4 | 0x08 | When transitioning from >>> + +-------------------+ | Secure to Non-secure >>> + | Reserved | 0x04 | >>> + +-------------------+ | >>> + | Magic signature | 0x00 | >>> + +===================+ --+ <-- New SP */ >>> + >>> /* With the Security extension, the hardware saves R4..R11 too. */ >>> if (exc_return && tdep->have_sec_ext && secure_stack_used >>> && (!default_callee_register_stacking || exception_domain_is_secure)) >>> @@ -3475,25 +3526,28 @@ arm_m_exception_cache (struct frame_info *this_frame) >>> if (tdep->have_sec_ext && !default_callee_register_stacking) >>> { >>> /* Handle floating-point callee saved registers. */ >>> - fpu_regs_stack_offset = 0x90; >>> + fpu_regs_stack_offset = unwound_sp + sp_r0_offset + 0x68; >>> for (i = 8; i < 16; i++) >>> { >>> cache->saved_regs[ARM_D0_REGNUM + i].set_addr (fpu_regs_stack_offset); >>> fpu_regs_stack_offset += 8; >>> } >>> - arm_cache_set_active_sp_value (cache, tdep, unwound_sp + sp_r0_offset + 0xD0); >>> + arm_cache_set_active_sp_value (cache, tdep, >>> + unwound_sp + sp_r0_offset + 0xA8); >>> } >>> else >>> { >>> /* Offset 0x64 is reserved. */ >>> - arm_cache_set_active_sp_value (cache, tdep, unwound_sp + sp_r0_offset + 0x68); >>> + arm_cache_set_active_sp_value (cache, tdep, >>> + unwound_sp + sp_r0_offset + 0x68); >>> } >>> } >>> else >>> { >>> /* Standard stack frame type used. */ >>> - arm_cache_set_active_sp_value (cache, tdep, unwound_sp + sp_r0_offset + 0x20); >>> + arm_cache_set_active_sp_value (cache, tdep, >>> + unwound_sp + sp_r0_offset + 0x20); >>> } >>> /* If bit 9 of the saved xPSR is set, then there is a four-byte >> >> >> Thanks, >> >> Christophe > > Here is the updated version: > > --- > gdb/arm-tdep.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 61 insertions(+), 4 deletions(-) > > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index 50ec41a66b1..6998fbd24e9 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -3417,6 +3417,60 @@ arm_m_exception_cache (struct frame_info *this_frame) > /* Fetch the SP to use for this frame. */ > unwound_sp = arm_cache_get_prev_sp_value (cache, tdep); > > + /* Exception entry context stacking are described in ARMv8-M (section B3.19) > + and ARMv7-M (sections B1.5.6 and B1.5.7) Architecture Reference Manuals. > + > + The following figure shows the structure of the stack frame when Security > + and Floating-point extensions are present. > + > + SP Offsets > + Without With > + Callee Regs Callee Regs > + (Secure -> Non-Secure) > + +-------------------+ > + 0xA8 | | 0xD0 > + +===================+ --+ <-- Original SP > + 0xA4 | S31 | 0xCC | > + +-------------------+ | > + ... | Additional FP Context > + +-------------------+ | > + 0x68 | S16 | 0x90 | > + +===================+ --+ > + 0x64 | Reserved | 0x8C | > + +-------------------+ | > + 0x60 | FPSCR | 0x88 | > + +-------------------+ | > + 0x5C | S15 | 0x84 | FP Context > + +-------------------+ | > + ... | > + +-------------------+ | > + 0x20 | S0 | 0x48 | > + +===================+ --+ > + 0x1C | xPSR | 0x44 | > + +-------------------+ | > + 0x18 | Return address | 0x40 | > + +-------------------+ | > + 0x14 | LR(R14) | 0x3C | > + +-------------------+ | > + 0x10 | R12 | 0x38 | State Context > + +-------------------+ | > + 0x0C | R3 | 0x34 | > + +-------------------+ | > + ... | > + +-------------------+ | > + 0x00 | R0 | 0x28 | > + +===================+ --+ > + | R11 | 0x24 | > + +-------------------+ | > + ... | > + +-------------------+ | Additional State Context > + | R4 | 0x08 | When transitioning from > + +-------------------+ | Secure to Non-secure Additional State Context -> Additional State Context When -> when Non-secure -> Non-Secure > + | Reserved | 0x04 | > + +-------------------+ | > + | Magic signature | 0x00 | > + +===================+ --+ <-- New SP */ > + > /* With the Security extension, the hardware saves R4..R11 too. */ > if (exc_return && tdep->have_sec_ext && secure_stack_used > && (!default_callee_register_stacking || exception_domain_is_secure)) > @@ -3475,25 +3529,28 @@ arm_m_exception_cache (struct frame_info *this_frame) > if (tdep->have_sec_ext && !default_callee_register_stacking) > { > /* Handle floating-point callee saved registers. */ > - fpu_regs_stack_offset = 0x90; > + fpu_regs_stack_offset = unwound_sp + sp_r0_offset + 0x68; > for (i = 8; i < 16; i++) > { > cache->saved_regs[ARM_D0_REGNUM + i].set_addr (fpu_regs_stack_offset); > fpu_regs_stack_offset += 8; > } > > - arm_cache_set_active_sp_value (cache, tdep, unwound_sp + sp_r0_offset + 0xD0); > + arm_cache_set_active_sp_value (cache, tdep, > + unwound_sp + sp_r0_offset + 0xA8); > } > else > { > /* Offset 0x64 is reserved. */ > - arm_cache_set_active_sp_value (cache, tdep, unwound_sp + sp_r0_offset + 0x68); > + arm_cache_set_active_sp_value (cache, tdep, > + unwound_sp + sp_r0_offset + 0x68); > } > } > else > { > /* Standard stack frame type used. */ > - arm_cache_set_active_sp_value (cache, tdep, unwound_sp + sp_r0_offset + 0x20); > + arm_cache_set_active_sp_value (cache, tdep, > + unwound_sp + sp_r0_offset + 0x20); > } > > /* If bit 9 of the saved xPSR is set, then there is a four-byte Otherwise, with Christophe's feedback and the above nits fixed, along with a commit message, this is OK. Thanks!