Wild and Crazy hacking under Solaris
Fri Jan 31 16:17:00 GMT 1997
Joe DeVincentis wrote:
> Anyone out there tried to catch a fault (like SIGSEGV) under
> Solaris and modify the "local" and "in" registers(%l0-%l7 and
> %i0 - %i7), so that they get restored when you "setcontext()"?
> I am finding that I can access / modify the registers available
> in the ucontext structure passed to my signal handler, (%o and %g registers),
> but I can't find any info on where the other registers are, and if it is
> possible to get them "restored" from the stack...
> I created a program to put specific values in some of the registers
> and looked at the stack on a fault and found them, but they don't seem
> to get restored on "setcontext()".
> Thanks - Joe
This may be totally unrelated, but ...
I assume you are targetting a SPARC architecture. I believe SPARC uses
"register windows". I discovered this years ago, when I ported
malloc_trace(free ware) from the sun3(motorola) to the sun4(SPARC)
architecture. malloc_trace is a plumbing tool for locating memory leaks.
It produces traceback reports showing where you called malloc(3) but
never called free(3) in c programs. The traceback mechanism would not
work on sun4 until I "flushed" the registers by exhausting all of the
register windows. I believe there is a system trap to do this, but I
was/am not versed in sparc, so I simply called a stub function six or
seven times (sun4's have/had seven register sets). This "flushed" the
registers to memory (at least the ones I needed to produce a traceback)
where I could traceback all the frames. This was about 8 years ago, so
don't quote me on this information.
/| |\ Nathan Banks Email: firstname.lastname@example.org
/ | | \ IEX Corporation Voice: +1.972.301.1206
\ | | / 2425 North Central Expway, Suite 700 Fax: +1.972.301.1200
\| |/ Richardson, Texas 75080 HAM: KC5RSE
More information about the crossgcc