xref: /csrg-svn/sys/tahoe/include/profile.h (revision 55305)
1*55305Smckusick /*
2*55305Smckusick  * Copyright (c) 1992 The Regents of the University of California.
3*55305Smckusick  * All rights reserved.
4*55305Smckusick  *
5*55305Smckusick  * %sccs.include.redist.c%
6*55305Smckusick  *
7*55305Smckusick  *	@(#)profile.h	7.1 (Berkeley) 07/16/92
8*55305Smckusick  */
9*55305Smckusick 
10*55305Smckusick #define	_MCOUNT_DECL static inline void _mcount
11*55305Smckusick 
12*55305Smckusick #define	MCOUNT \
13*55305Smckusick extern void mcount(cntpa) asm("mcount"); void mcount(cntpa) long **cntpa; { \
14*55305Smckusick 	int selfpc, frompcindex; \
15*55305Smckusick 	/* \
16*55305Smckusick 	 * Find the return address for mcount, \
17*55305Smckusick 	 * and address of counter pointer. \
18*55305Smckusick 	 */ \
19*55305Smckusick 	selfpc = *((char **)&cntpa-3);	/* -8(fp) */ \
20*55305Smckusick 	frompcindex = \
21*55305Smckusick 	    (unsigned short *)(*((((long *)*((char **)&cntpa-1)))-2)); \
22*55305Smckusick 	_mcount(frompcindex, selfpc); \
23*55305Smckusick }
24