public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Michael Zimmermann <sigmaepsilon92@gmail.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH 2/2] ArmPkg/DefaultExceptionHandlerLib AARCH64: add minimal backtrace to crash dump
Date: Fri, 9 Sep 2016 14:08:33 +0100	[thread overview]
Message-ID: <CAKv+Gu-Uo9hRSOmE_bK0mGkWQUsAs+iBB+bns0CL5f5rdT24TA@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu8o3D7AvmXRZMK7OiXjMOZ-3DdcvB78vtwEAvWgKt7v0Q@mail.gmail.com>

On 7 September 2016 at 12:32, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 7 September 2016 at 12:25, Michael Zimmermann
> <sigmaepsilon92@gmail.com> wrote:
>>> However, looking at this
>>> code, this is still not sufficient to find the *next* frame pointer on
>>> the stack.
>> are you sure about that? this code looks like it does just that:
>> https://github.com/torvalds/linux/blob/master/arch/arm/kernel/stacktrace.c
>>
>
> First of all, that comment makes little sense:
>
> * With framepointer enabled, a simple function prologue looks like this:
> * mov ip, sp
> * stmdb sp!, {fp, ip, lr, pc}
>
> I assume this should be
>
> stmdb sp!, {fp, ip, lr}
>
> * sub fp, ip, #4
> *
> * A simple function epilogue looks like this:
> * ldm sp, {fp, sp, pc}
>

OK, I spoke a bit too soon. The 'pop' does not actually increment the
stack pointer, so while the push does make sense (and pushing the pc
in addition is just informational), the pop should actually be
implemented as

ldm sp, {fp, sp, lr}

... do other stuff including incrementing the sp to its original value ...

bx lr

In any case, unless you have any information that suggests that GCC in
Thumb2 mode can be coerced into managing the frame pointer in a way
that allows us to do something similar in EDK2, I am going to stick
with my assertion that this is not currently possible on ARM.

Thanks,
Ard.


  reply	other threads:[~2016-09-09 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07  8:21 [PATCH 1/2] BaseTools/tools_def AARCH64: enable frame pointers for DEBUG builds Ard Biesheuvel
2016-09-07  8:21 ` [PATCH 2/2] ArmPkg/DefaultExceptionHandlerLib AARCH64: add minimal backtrace to crash dump Ard Biesheuvel
2016-09-07  9:48   ` Michael Zimmermann
2016-09-07 11:03     ` Ard Biesheuvel
2016-09-07 11:25       ` Michael Zimmermann
2016-09-07 11:32         ` Ard Biesheuvel
2016-09-09 13:08           ` Ard Biesheuvel [this message]
2016-09-09 18:03             ` Michael Zimmermann
2016-09-09 16:03   ` Andrew Fish
2016-09-07 15:00 ` [PATCH 1/2] BaseTools/tools_def AARCH64: enable frame pointers for DEBUG builds Leif Lindholm

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-list 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=CAKv+Gu-Uo9hRSOmE_bK0mGkWQUsAs+iBB+bns0CL5f5rdT24TA@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /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