lkml.org 
[lkml]   [2009]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/6] mips dynamic function tracer support

On Wed, 3 Jun 2009, Wang Liming wrote:

> wu zhangjin wrote:
> > hi,
> >
> > sorry, I'm so late to reply your E-mail, a little busy these days.
> > >
> > > }
> > >
> > > ----------arch/mips/kernel/module.c:apply_r_mips_26_rel()-------------------
> > >
> > > v is kernel _mcount's address, location is the address of the instrution
> > > that should be relocated;
> > >
> > > To resolve this problem, we may need to do more work, either on gcc or on
> > > the kernel. So I want to hear your test result and if you have solution,
> > > please let me know.
> > >
> >
> > yes, current version of mips-specific dynamic ftrace not support modules
> > yet.
> >
> > there is similar solution implemented in PowerPC(something named
> > trampoline),
> > although I did not look into it, but I'm sure we can implement the
> > mips-specific one
> > via imitating it.
> Good hit. I may have a look on Powerpc implementation.

Note, PowerPC uses a trampoline from modules to kernel core. I think MIPS
just calls mcount differently. That is, it does a full 32bit address call
(64 bit for 64 bit archs?). Something like:

lui v1, _mcount
addiu v1, v1, _mcount
jalr v1
addiu sp, sp, -8

Then a nop would not do. Due to preemption, we can not modify more than
one line. But you could modify it to:

b 1f
addiu v1, v1, _mcount
jalr v1
addiu sp, sp, -8
1:

Clobbering v1 should not be an issue since it is already used to store
_mcount. That is, we still do the addiu v1,v1,_mcount with that branch.
But v1 should be ignored.

-- Steve



\
 
 \ /
  Last update: 2009-06-03 14:49    [W:0.067 / U:2.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site