lkml.org 
[lkml]   [2018]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/18] tracing/x86: Add arch_get_func_args() function
On Thu, 8 Feb 2018 14:28:13 +0900
Namhyung Kim <namhyung@kernel.org> wrote:

> Hi Steve,
>
> On Fri, Feb 02, 2018 at 06:05:02PM -0500, Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >
> > Add function to get the function arguments from pt_regs.
> >
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > ---
> > arch/x86/kernel/ftrace.c | 28 ++++++++++++++++++++++++++++
> > 1 file changed, 28 insertions(+)
> >
> > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> > index 01ebcb6f263e..5e845c8cf89d 100644
> > --- a/arch/x86/kernel/ftrace.c
> > +++ b/arch/x86/kernel/ftrace.c
> > @@ -46,6 +46,34 @@ int ftrace_arch_code_modify_post_process(void)
> > return 0;
> > }
> >
> > +int arch_get_func_args(struct pt_regs *regs,
> > + int start, int end, long *args)
> > +{
> > +#ifdef CONFIG_X86_64
> > +# define MAX_ARGS 6
> > +# define INIT_REGS \
> > + { regs->di, regs->si, regs->dx, \
> > + regs->cx, regs->r8, regs->r9 \
> > + }
> > +#else
> > +# define MAX_ARGS 3
> > +# define INIT_REGS \
> > + { regs->ax, regs->dx, regs->cx }
> > +#endif
> > + if (!regs)
> > + return MAX_ARGS;
> > +
> > + {
> > + long pt_args[] = INIT_REGS;
> > + int i;
> > +
> > + for (i = start; i <= end && i < MAX_ARGS; i++)
> ^^^^^^^^
>
> I expected it being 'i < end' based on your description.
>

Ug. Thanks for pointing that out.

-- Steve

>
> > + args[i - start] = pt_args[i];
> > +
> > + return i - start;
> > + }
> > +}
> > +
> > union ftrace_code_union {
> > char code[MCOUNT_INSN_SIZE];
> > struct {
> > --
> > 2.15.1
> >
> >

\
 
 \ /
  Last update: 2018-02-08 16:30    [W:0.094 / U:11.392 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site