[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090324221439.GE29509@elte.hu>
Date: Tue, 24 Mar 2009 23:14:39 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: Tim Bird <tim.bird@...sony.com>,
linux-arm-kernel <linux-arm-kernel@...ts.arm.linux.org.uk>,
linux kernel <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Abhishek Sagar <sagar.abhishek@...il.com>,
Russell King <rmk@....linux.org.uk>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Subject: Re: Anyone working on ftrace function graph support on ARM?
* Frederic Weisbecker <fweisbec@...il.com> wrote:
> On Tue, Mar 24, 2009 at 10:48:46PM +0100, Ingo Molnar wrote:
> >
> > * Frederic Weisbecker <fweisbec@...il.com> wrote:
> >
> > > Well it's a very naive listing, there are sometimes some problems.
> > > For example on x86-64, I had to save even some non-scratch
> > > registers before calling the return hook, I still don't know why.
> >
> > btw., which are those registers?
> >
> > Ingo
>
>
> I would expect to only save rax,rdi,rsi,rdx,rcx,r8,r9 which are
> used for parameters.
> And I had some crashes until I append r10 and r11 which actually
> are scratch if I'm not wrong, but since they are scratch and are
> not used for arguments, I thought they didn't need to be saved.
>
> Well, I think there were some code flow cases I was missing.
Correct, r10 and r11 are clobbered registers too - and you need to
save them too in mcount methods.
The reason is that mcount has a special calling convention - it's
not just about not destroying arguments - GCC can keep data in r10
or r11 scratch registers across function calls as well - for example
for relatively static functions that are in its local optimization
scope.
If GCC can prove that the local scope function itself does not
clobber r10/r11, it does not have to clobber them across the
function call. But the mcount() callback still gets inserted.
So the rule is: mcount must not destroy _any_ register state.
(beyond flags)
ngo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists