[PATCH v2 0/7] Fix backtrace support in THUMB2 mode

Nikolay Borisov Nikolay.Borisov at arm.com
Mon Jun 2 01:34:58 PDT 2014


[Adding Dave Martin as CC]

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd at arndb.de]
> Sent: 31 May 2014 19:32
> To: linux-arm-kernel at lists.infradead.org
> Cc: Nikolay Borisov; rric at kernel.org; Will Deacon; u.kleine-
> koenig at pengutronix.de
> Subject: Re: [PATCH v2 0/7] Fix backtrace support in THUMB2 mode
>
> On Friday 30 May 2014 17:59:44 Nikolay Borisov wrote:
> > From: Nikolay Borisov <Nikolay.Borisov at arm.com>
> >
> > Currently all the code which deals with backtrace support assumes
> that R11
> > is the frame-pointer. While this is the case for ARM mode and is
> explicitly
> > documented in the AAPCS, this is not the case for THUMB2 mode.
> >
> > There is no official document requiring that R11 has to be the frame
> pointer
> > and GCC uses R7 as FP and given that R7's usage is so intertwined
> within GCC's
> > mechanics it is unlikely to change, so fixing backtrace in THUMB2
> mode seems
> > in order.
> >
> > This patch series rectifies the problem by first fixing the
> > thread_save_fp macro to reference the correct register. Furthermore,
> there
> > a lot of repetetive sequences of code such as :
> >
> > stackframe.fp = pt_regs->ARM_fp
> > stackframe.lr = pt_regs->ARM_lr
> >
> > so introducing a function arm_get_current_stack_frame which both
> > hides this repetition and also utilizes teh frame_pointer(regs) macro
> > to reference the correct register depending on the mode.
> >
> > Finally, change all the call sites so that they utilize the new
> routine.
>
> Sorry for the stupid question, but does your series relate to the
> #warning "TODO: return_address should use unwind tables" that we see
> all the time in arch/arm/kernel/return_address.c?
>

My changes have nothing to do with the use of unwind table whatsoever,
I guess this warning is a result of a completely different issue. Probably
Dave Martin could shed more light on this.

> If I remember the story correctly, the problem is that so far we could
> never use the frame pointer in thumb2 mode, and nobody has implemented
> a version of that function using the arm unwinder.
>
> Are we now able to use the frame pointer after all?

What my changes implement, boils down to referring the correct register
Which acts as a frame pointer depending on whether we are running a THUMB2
Kernel or not.

>
>       Arnd
>

Regards,
Nikolay


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782




More information about the linux-arm-kernel mailing list