Subject: Re: kernel profiling broken on mips?
To: Castor Fu <castor@geocast.net>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 02/21/1999 15:27:12
hi Castor,

Thanks, that helped.  Turns out that the statclock() pc-sampling works
fine, but that the mcount() calls for gprof call-graph sampling are busted.

I cant see anywhere that _ever_ acutally allocated space for the
register- saves of $a0-a3 done in mcount().  I tried allocating space
in MCOUNT (see mips/include/profile.h), but that still didn't work.

Pruning the kernel MCOUNT down to

#define	MCOUNT \
	__asm__(".globl _mcount;" \
	".type _mcount,@function;" \
	"_mcount:;" \
	".set noreorder;" \
	".set noat;" \
	"addu $29,$29,8;" \
	"j $31;" \
	"move $31,$1;" \
	".set reorder;" \
	".set at");


gives me a kernel where PC-sampling works, but obviously without any
call counts or dynamic call-graph info. More as I find out.

(NB: it seems the ABI requires the caller of mcount to push 2
register's worth of space; see tghe macro FUNCTION_PROFILER in
src/gnu/dist/gcc/config/mips/include/mips.h.)