[PATCH 2/4] ARM: extract out insn generation code from ftrace

Rabin Vincent rabin at rab.in
Tue Nov 22 13:25:49 EST 2011


On Tue, Nov 22, 2011 at 19:26, Dave Martin <dave.martin at linaro.org> wrote:
> On Tue, Nov 22, 2011 at 07:02:13PM +0530, Rabin Vincent wrote:
>> It's not used on Thumb-2.  This is only used by the function graph
>> tracer and that depends on !THUMB2_KERNEL.
>
> I assume there's no special reason why this doesn't work with a Thumb-2
> kernel, other than that it simply hasn't implemented yet?

The function graph tracer expects to get a pointer to the saved return
address of the function (on the stack).  It changes this to its own
return_hooker function where it records the exit from the function and
jumps to the real return address.

We do this for ARM (the instruction set) by building with frame pointers,
and the function prologues always save the registers in the expected
order and the epilogues restore them out from the saved locations.

However, with Thumb-2, we don't get frame pointers even if we ask for
them.  So to support Thumb-2 we'd probably need a way to find and modify
the LR without it being at a fixed location (MIPS does something similar
IIRC).  I haven't really looked into it.



More information about the linux-arm-kernel mailing list