xref: /csrg-svn/sys/hp300/include/profile.h (revision 55186)
1*55186Smckusick /*
2*55186Smckusick  * Copyright (c) 1992 The Regents of the University of California.
3*55186Smckusick  * All rights reserved.
4*55186Smckusick  *
5*55186Smckusick  * %sccs.include.redist.c%
6*55186Smckusick  *
7*55186Smckusick  *	@(#)profile.h	7.1 (Berkeley) 07/14/92
8*55186Smckusick  */
9*55186Smckusick 
10*55186Smckusick #define	_MCOUNT_DECL static inline void _mcount
11*55186Smckusick 
12*55186Smckusick #define	MCOUNT \
13*55186Smckusick extern void mcount() asm("mcount"); void mcount() { \
14*55186Smckusick 	int selfpc, frompcindex; \
15*55186Smckusick 	asm("movl a6@(4),%0" : "=r" (selfpc)); \
16*55186Smckusick 	asm("movl a6@(0)@(4),%0" : "=r" (frompcindex)); \
17*55186Smckusick 	_mcount(frompcindex, selfpc); \
18*55186Smckusick }
19*55186Smckusick 
20*55186Smckusick #ifdef KERNEL
21*55186Smckusick /*
22*55186Smckusick  * The following two macros do splhigh and splx respectively.
23*55186Smckusick  * They have to be defined this way because these are real
24*55186Smckusick  * functions on the HP, and we do not want to invoke mcount
25*55186Smckusick  * recursively.
26*55186Smckusick  */
27*55186Smckusick #define MCOUNT_ENTER \
28*55186Smckusick 	asm("movw	sr,%0" : "=g" (s)); \
29*55186Smckusick 	asm("movw	#0x2700,sr")
30*55186Smckusick 
31*55186Smckusick #define MCOUNT_EXIT \
32*55186Smckusick 	asm("movw	%0,sr" : : "g" (s))
33*55186Smckusick #endif /* KERNEL */
34