lkml.org 
[lkml]   [2007]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: MIPS RT debug support

On Thu, 15 Nov 2007, john cooper wrote:

>
> It isn't an issue of getting a hook into the FUNCTION_PROLOGUE
> (mcount() here) but rather of emulating the CALLER_ADDR[0123]
> defs which map onto the gcc internal __builtin_return_address().
> Doing so using the affectionately dubbed "Three Stooges Algorithm"
> called out in the MIPS ABI is both complex and nondeterministic.
>
> The entry FUNCTION_PROLOGUE hook provides a means to log the path
> traveled thus far. __builtin_return_address() gives a way to
> snapshot a stub of the stack invocation. Together they provide
> somewhat complimentary but useful debug information.
>
> We could log the stack invocation progress in the latency
> instrumentation itself by noting a new invocation in the
> FUNCTION_PROLOGUE and unwind of the same in the currently
> unused FUNCTION_EPILOGUE hook. So we're just shadowing the
> actual runtime stack in effect with a data structure which
> can be traversed far more easily.
>

IIRC, only CALLER_ADDR0 is actually used (I've found that the others are
mostly unreliable). I thought that mips always has one register that
holds the return address of the function. It's been several years since
I've worked on mips (I'd love to do it again, if someone sends me a box!,
hint hint). So the __builtin_return_address(0) should simply return that
register. Now I'm being a bit lazy, and I'm not pulling out my MIPS books,
so I could be completely wrong on this.

-- Steve

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-16 03:29    [W:0.043 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site