xref: /csrg-svn/sys/hp300/include/profile.h (revision 63160)
155186Smckusick /*
2*63160Sbostic  * Copyright (c) 1992, 1993
3*63160Sbostic  *	The Regents of the University of California.  All rights reserved.
455186Smckusick  *
555186Smckusick  * %sccs.include.redist.c%
655186Smckusick  *
7*63160Sbostic  *	@(#)profile.h	8.1 (Berkeley) 06/10/93
855186Smckusick  */
955186Smckusick 
1055186Smckusick #define	_MCOUNT_DECL static inline void _mcount
1155186Smckusick 
1255186Smckusick #define	MCOUNT \
1355186Smckusick extern void mcount() asm("mcount"); void mcount() { \
1455186Smckusick 	int selfpc, frompcindex; \
1555186Smckusick 	asm("movl a6@(4),%0" : "=r" (selfpc)); \
1655186Smckusick 	asm("movl a6@(0)@(4),%0" : "=r" (frompcindex)); \
1755186Smckusick 	_mcount(frompcindex, selfpc); \
1855186Smckusick }
1955186Smckusick 
2055186Smckusick #ifdef KERNEL
2155186Smckusick /*
2255186Smckusick  * The following two macros do splhigh and splx respectively.
2355186Smckusick  * They have to be defined this way because these are real
2455186Smckusick  * functions on the HP, and we do not want to invoke mcount
2555186Smckusick  * recursively.
2655186Smckusick  */
2755186Smckusick #define MCOUNT_ENTER \
2855186Smckusick 	asm("movw	sr,%0" : "=g" (s)); \
2955186Smckusick 	asm("movw	#0x2700,sr")
3055186Smckusick 
3155186Smckusick #define MCOUNT_EXIT \
3255186Smckusick 	asm("movw	%0,sr" : : "g" (s))
3355186Smckusick #endif /* KERNEL */
34