xref: /csrg-svn/sys/pmax/include/profile.h (revision 63217)
155711Sbostic /*
2*63217Sbostic  * Copyright (c) 1992, 1993
3*63217Sbostic  *	The Regents of the University of California.  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*63217Sbostic  *	@(#)profile.h	8.1 (Berkeley) 06/10/93
1155711Sbostic  */
1255711Sbostic 
1358281Sralph #define	_MCOUNT_DECL static void __mcount
1455711Sbostic 
1558130Sralph #define	MCOUNT \
1658281Sralph 	asm(".globl _mcount;" \
1758281Sralph 	"_mcount:;" \
1858281Sralph 	".set noreorder;" \
1958281Sralph 	".set noat;" \
2058281Sralph 	"sw $4,8($29);" \
2158281Sralph 	"sw $5,12($29);" \
2258281Sralph 	"sw $6,16($29);" \
2358281Sralph 	"sw $7,20($29);" \
2458281Sralph 	"sw $1,0($29);" \
2558281Sralph 	"sw $31,4($29);" \
2658281Sralph 	"move $5,$31;" \
2758281Sralph 	"jal __mcount;" \
2858281Sralph 	"move $4,$1;" \
2958281Sralph 	"lw $4,8($29);" \
3058281Sralph 	"lw $5,12($29);" \
3158281Sralph 	"lw $6,16($29);" \
3258281Sralph 	"lw $7,20($29);" \
3358281Sralph 	"lw $31,4($29);" \
3458281Sralph 	"lw $1,0($29);" \
3558281Sralph 	"addu $29,$29,8;" \
3658281Sralph 	"j $31;" \
3758281Sralph 	"move $31,$1;" \
3858281Sralph 	".set reorder;" \
3958281Sralph 	".set at");
4055711Sbostic 
4155711Sbostic #ifdef KERNEL
4255711Sbostic /*
4355711Sbostic  * The following two macros do splhigh and splx respectively.
4455711Sbostic  * They have to be defined this way because these are real
4555711Sbostic  * functions on the PMAX, and we do not want to invoke mcount
4655711Sbostic  * recursively.
4755711Sbostic  */
4859828Sralph #define	MCOUNT_ENTER	s = _splhigh()
4955711Sbostic 
5059828Sralph #define	MCOUNT_EXIT	_splx(s)
5155711Sbostic #endif /* KERNEL */
52