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