Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set
From: Josh Poimboeuf
Date: Wed Mar 15 2017 - 17:55:56 EST
On Wed, Mar 15, 2017 at 03:55:32PM -0400, Steven Rostedt wrote:
> +#ifdef USING_FRAME_POINTER
> +# ifdef CC_USING_FENTRY
> + /*
> + * Frame pointers are of ip followed by bp.
> + * Since fentry is an immediate jump, we are left with
> + * parent-ip, function-ip. We need to add a frame with
> + * parent-ip followed by ebp.
> + */
> + pushl 4(%esp) /* parent ip */
> pushl %ebp
> movl %esp, %ebp
> -
> + pushl 2*4(%esp) /* function ip */
> +# endif
> + /* For mcount, the function ip is directly above */
> + pushl %ebp
> + movl %esp, %ebp
> +#endif
More vertical operand alignment issues.
> @@ -85,6 +140,10 @@ ENTRY(ftrace_regs_caller)
> pushl %edx
> pushl %ecx
> pushl %ebx
> +#ifndef USING_FRAME_POINTER
> + /* Load 4 off of the parent ip addr into ebp */
> + lea 14*4(%esp), %ebp
> +#endif
Instead of:
#ifndef USING_FRAME_POINTER
Shouldn't it be:
#ifdef CC_USING_FENTRY
?
Otherwise, if I'm reading it right, with fentry and
CONFIG_FRAME_POINTER=y, ebp will lead to the grandparent's ip instead of
the parent's ip.
--
Josh