Annotation of sys/arch/mips64/include/profile.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: profile.h,v 1.2 2005/08/07 07:29:44 miod Exp $ */
2:
3: /*
4: * Copyright (c) 1992, 1993
5: * The Regents of the University of California. All rights reserved.
6: *
7: * This code is derived from software contributed to Berkeley by
8: * Ralph Campbell.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. Neither the name of the University nor the names of its contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
34: * from: @(#)profile.h 8.1 (Berkeley) 6/10/93
35: */
36: #ifndef _MIPS_PROFILE_H_
37: #define _MIPS_PROFILE_H_
38:
39: #define _MCOUNT_DECL static void ___mcount
40:
41: /*XXX The cprestore instruction is a "dummy" to shut up as(1). */
42:
43: #define MCOUNT \
44: __asm(".globl _mcount;" \
45: ".type _mcount,@function;" \
46: "_mcount:;" \
47: ".set noreorder;" \
48: ".set noat;" \
49: ".cpload $25;" \
50: ".cprestore 4;" \
51: "sw $4,8($29);" \
52: "sw $5,12($29);" \
53: "sw $6,16($29);" \
54: "sw $7,20($29);" \
55: "sw $1,0($29);" \
56: "sw $31,4($29);" \
57: "move $5,$31;" \
58: "jal ___mcount;" \
59: "move $4,$1;" \
60: "lw $4,8($29);" \
61: "lw $5,12($29);" \
62: "lw $6,16($29);" \
63: "lw $7,20($29);" \
64: "lw $31,4($29);" \
65: "lw $1,0($29);" \
66: "addu $29,$29,8;" \
67: "j $31;" \
68: "move $31,$1;" \
69: ".set reorder;" \
70: ".set at");
71:
72: #ifdef _KERNEL
73: /*
74: * The following two macros do splhigh and splx respectively.
75: * They have to be defined this way because these are real
76: * functions on the MIPS, and we do not want to invoke mcount
77: * recursively.
78: */
79: #define MCOUNT_ENTER s = _splhigh()
80:
81: #define MCOUNT_EXIT _splx(s)
82: #endif /* _KERNEL */
83:
84: #endif /* !_MIPS_PROFILE_H_ */
CVSweb