profile.h revision 1.2
11.1Sderaadt/*
21.2Sglass * Copyright (c) 1992, 1993
31.2Sglass *	The Regents of the University of California.  All rights reserved.
41.1Sderaadt *
51.1Sderaadt * This code is derived from software contributed to Berkeley by
61.1Sderaadt * Ralph Campbell.
71.1Sderaadt *
81.1Sderaadt * Redistribution and use in source and binary forms, with or without
91.1Sderaadt * modification, are permitted provided that the following conditions
101.1Sderaadt * are met:
111.1Sderaadt * 1. Redistributions of source code must retain the above copyright
121.1Sderaadt *    notice, this list of conditions and the following disclaimer.
131.1Sderaadt * 2. Redistributions in binary form must reproduce the above copyright
141.1Sderaadt *    notice, this list of conditions and the following disclaimer in the
151.1Sderaadt *    documentation and/or other materials provided with the distribution.
161.1Sderaadt * 3. All advertising materials mentioning features or use of this software
171.1Sderaadt *    must display the following acknowledgement:
181.1Sderaadt *	This product includes software developed by the University of
191.1Sderaadt *	California, Berkeley and its contributors.
201.1Sderaadt * 4. Neither the name of the University nor the names of its contributors
211.1Sderaadt *    may be used to endorse or promote products derived from this software
221.1Sderaadt *    without specific prior written permission.
231.1Sderaadt *
241.1Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
251.1Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
261.1Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
271.1Sderaadt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
281.1Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
291.1Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
301.1Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
311.1Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
321.1Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
331.1Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
341.1Sderaadt * SUCH DAMAGE.
351.1Sderaadt *
361.2Sglass *	from: @(#)profile.h	8.1 (Berkeley) 6/10/93
371.2Sglass *      $Id: profile.h,v 1.2 1994/05/27 08:40:57 glass Exp $
381.1Sderaadt */
391.1Sderaadt
401.1Sderaadt#define	_MCOUNT_DECL static void __mcount
411.1Sderaadt
421.1Sderaadt#define	MCOUNT \
431.1Sderaadt	asm(".globl _mcount;" \
441.1Sderaadt	"_mcount:;" \
451.1Sderaadt	".set noreorder;" \
461.1Sderaadt	".set noat;" \
471.1Sderaadt	"sw $4,8($29);" \
481.1Sderaadt	"sw $5,12($29);" \
491.1Sderaadt	"sw $6,16($29);" \
501.1Sderaadt	"sw $7,20($29);" \
511.1Sderaadt	"sw $1,0($29);" \
521.1Sderaadt	"sw $31,4($29);" \
531.1Sderaadt	"move $5,$31;" \
541.1Sderaadt	"jal __mcount;" \
551.1Sderaadt	"move $4,$1;" \
561.1Sderaadt	"lw $4,8($29);" \
571.1Sderaadt	"lw $5,12($29);" \
581.1Sderaadt	"lw $6,16($29);" \
591.1Sderaadt	"lw $7,20($29);" \
601.1Sderaadt	"lw $31,4($29);" \
611.1Sderaadt	"lw $1,0($29);" \
621.1Sderaadt	"addu $29,$29,8;" \
631.1Sderaadt	"j $31;" \
641.1Sderaadt	"move $31,$1;" \
651.1Sderaadt	".set reorder;" \
661.1Sderaadt	".set at");
671.1Sderaadt
681.1Sderaadt#ifdef KERNEL
691.1Sderaadt/*
701.1Sderaadt * The following two macros do splhigh and splx respectively.
711.1Sderaadt * They have to be defined this way because these are real
721.1Sderaadt * functions on the PMAX, and we do not want to invoke mcount
731.1Sderaadt * recursively.
741.1Sderaadt */
751.2Sglass#define	MCOUNT_ENTER	s = _splhigh()
761.1Sderaadt
771.2Sglass#define	MCOUNT_EXIT	_splx(s)
781.1Sderaadt#endif /* KERNEL */
79