All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philippe.mathieu.daude@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 0/2] target/arm: Improve M-profile exception logging
Date: Wed, 16 Mar 2022 14:00:32 +0100	[thread overview]
Message-ID: <f4b7fdd1-a659-03ed-bfd7-a514b8e47588@gmail.com> (raw)
In-Reply-To: <20220315204306.2797684-1-peter.maydell@linaro.org>

On 15/3/22 21:43, Peter Maydell wrote:
> Our current logging for M-profile exceptions has a couple of holes
> which are particularly confusing for the case of an exception taken
> immediately out of reset:
>   * we don't log the initial PC/SP loaded from the vector table
>   * we don't log the PC we load from the vector table when
>     we take an exception
>   * we don't log the address for i-side aborts
> 
> This case is quite common where the user has failed to provide a
> vector table in their ELF file and QEMU thus loads garbage for the
> initial PC. At the moment the logging looks like:
> 
> $ qemu-system-arm [...] -d in_asm,cpu,exec,int
> Taking exception 3 [Prefetch Abort] on CPU 0
> ...with CFSR.IACCVIOL
> ...BusFault with BFSR.STKERR
> ...taking pending nonsecure exception 3
> ----------------
> IN:
> 0x20000558:  08000079  stmdaeq  r0, {r0, r3, r4, r5, r6}
> 
> 
> After this patchset it looks like:
> 
> $ qemu-system-arm [...] -d in_asm,cpu,exec,int
> Loaded reset SP 0x0 PC 0x0 from vector table
> Loaded reset SP 0xd008f8df PC 0xf000bf00 from vector table
> Taking exception 3 [Prefetch Abort] on CPU 0
> ...at fault address 0xf000bf00
> ...with CFSR.IACCVIOL
> ...BusFault with BFSR.STKERR
> ...taking pending nonsecure exception 3
> ...loading from element 3 of non-secure vector table at 0xc
> ...loaded new PC 0x20000558
> ----------------
> IN:
> 0x20000558:  08000079  stmdaeq  r0, {r0, r3, r4, r5, r6}
> 
> and I think it is somewhat clearer that we loaded a bogus
> PC from the vector table at reset, faulted at that address,
> loaded the HardFault entry point which was bogus but at
> least readable, and started executing code from there.
> 
> The double-logging of the reset loads is the result of
> the way we currently reset the CPU twice on QEMU startup.
> If we ever manage to fix that silliness it'll go away.
> 
> 
> (Patchset inspired by a stackexchange question:
> https://stackoverflow.com/questions/71486314/loading-an-elf-file-into-qemu
> )
> 
> thanks
> -- PMM
> 
> Peter Maydell (2):
>    target/arm: Log M-profile vector table accesses
>    target/arm: Log fault address for M-profile faults

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

      parent reply	other threads:[~2022-03-16 13:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 20:43 [PATCH 0/2] target/arm: Improve M-profile exception logging Peter Maydell
2022-03-15 20:43 ` [PATCH 1/2] target/arm: Log M-profile vector table accesses Peter Maydell
2022-03-15 21:40   ` Richard Henderson
2022-03-16 11:40   ` Alex Bennée
2022-03-15 20:43 ` [PATCH 2/2] target/arm: Log fault address for M-profile faults Peter Maydell
2022-03-15 21:41   ` Richard Henderson
2022-03-16 12:03   ` Alex Bennée
2022-03-16 13:00 ` Philippe Mathieu-Daudé [this message]

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=f4b7fdd1-a659-03ed-bfd7-a514b8e47588@gmail.com \
    --to=philippe.mathieu.daude@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.