public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
To: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb/arm: Terminate frame unwinding in M-profile lockup state
Date: Sun, 16 Oct 2022 16:37:38 +0200	[thread overview]
Message-ID: <e51dd6fe-d4b5-d407-9818-25518f5967f2@foss.st.com> (raw)
In-Reply-To: <e6379ac4-a41b-0be2-6e13-f64a6d22ee7f@fbl.cz>



On 2022-10-16 15:59, Tomas Vanek wrote:
> Torbjorn,
> 
> thanks for the fast reply.
> 
> On 2022-10-16 10:13, Torbjorn SVENSSON wrote:
> 
>> >/  #0  0xeffffffe in ?? () />/  #1  0x0c000a9c in HardFault_Handler 
>> () />/      at 
>> />/C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/stm32l5xx_it.c:99 />/  #2  0x2002ffd8 in ?? () />/  Backtrace stopped: previous frame identical to this frame (corrupt />/stack?) />/  (gdb) />/---------------- />/The frame #1 is at correct PC taken from LR, #2 is a total nonsense. /
>> I think your assumption here is wrong as 0xeffffffe is a valid value for
>> Cortex-M33 with TrustZone (FNC_RETURN with S=0). See more on the comment
>> below.
> 'B3.17 Function returns from Non-secure state' states:
> The FNC_RETURN value is:
> ... the original is a binary value in a table, hard to convert to plain 
> text ...
> so if I convert correctly
> 0xfefffffe or 0xfeffffff depending on S bit.
> 
> Starts with 0xfe not 0xef as the lockup magic!

Ohh, right, my bad!

> 
>> Reading B3.33 (revision B.m) in the ARMv8-M documentation about lockup
>> state, it's written that DHCSR.S_LOCKUP=1 AND PC=0xeffffffe. My
>> interpretations that the PC value alone is not enough.
> 
> Hmm, how would we read DHCSR then?
> IMO the PC value is enough.

Reading DHCSR should be similar to FPCCR and FPCAR.
According to the ARMv8-M manual, DHSCR should be located at 0xE000EDF0 
as a 32-bit read/write register and bit 19 is S_LOCKUP.

> 
> Tomas
> 

Kind regards,
Torbjörn

  parent reply	other threads:[~2022-10-16 14:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 13:59 Tomas Vanek
2022-10-16 13:59 ` Tomas Vanek
2022-10-16 14:37 ` Torbjorn SVENSSON [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-16  9:23 Tomas Vanek
2022-10-16 10:13 ` Torbjorn SVENSSON

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e51dd6fe-d4b5-d407-9818-25518f5967f2@foss.st.com \
    --to=torbjorn.svensson@foss.st.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).