xref: /csrg-svn/sys/pmax/include/profile.h (revision 58130)
155711Sbostic /*
255711Sbostic  * Copyright (c) 1992 Regents of the University of California.
355711Sbostic  * All rights reserved.
455711Sbostic  *
555711Sbostic  * This code is derived from software contributed to Berkeley by
655711Sbostic  * Ralph Campbell.
755711Sbostic  *
855711Sbostic  * %sccs.include.redist.c%
955711Sbostic  *
10*58130Sralph  *	@(#)profile.h	7.2 (Berkeley) 02/21/93
1155711Sbostic  */
1255711Sbostic 
13*58130Sralph #define	_MCOUNT_DECL static void _mcount
1455711Sbostic 
15*58130Sralph #define	MCOUNT \
16*58130Sralph 	asm(".globl mcount"); \
17*58130Sralph 	asm("mcount:"); \
18*58130Sralph 	asm(".set noreorder"); \
19*58130Sralph 	asm(".set noat"); \
20*58130Sralph 	asm("sw $31,4($29);"); \
21*58130Sralph 	asm("jal _mcount"); \
22*58130Sralph 	asm("sw $1,0($29);"); \
23*58130Sralph 	asm("lw $31,4($29)"); \
24*58130Sralph 	asm("lw $1,0($29)"); \
25*58130Sralph 	asm("addu $29,$29,8"); \
26*58130Sralph 	asm("j $31"); \
27*58130Sralph 	asm("move $31,$1"); \
28*58130Sralph 	asm(".set reorder"); \
29*58130Sralph 	asm(".set at");
3055711Sbostic 
3155711Sbostic #ifdef KERNEL
3255711Sbostic /*
3355711Sbostic  * The following two macros do splhigh and splx respectively.
3455711Sbostic  * They have to be defined this way because these are real
3555711Sbostic  * functions on the PMAX, and we do not want to invoke mcount
3655711Sbostic  * recursively.
3755711Sbostic  */
3855711Sbostic #define	MCOUNT_ENTER
3955711Sbostic 
4055711Sbostic #define	MCOUNT_EXIT
4155711Sbostic #endif /* KERNEL */
42