Annotation of sys/arch/sparc/include/profile.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: profile.h,v 1.8 2003/06/02 23:27:54 millert Exp $ */
2: /* $NetBSD: profile.h,v 1.8 1997/02/01 20:56:40 mrg Exp $ */
3:
4: /*
5: * Copyright (c) 1992, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * This software was developed by the Computer Systems Engineering group
9: * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10: * contributed to Berkeley.
11: *
12: * All advertising materials mentioning features or use of this software
13: * must display the following acknowledgement:
14: * This product includes software developed by the University of
15: * California, Lawrence Berkeley Laboratory.
16: *
17: * Redistribution and use in source and binary forms, with or without
18: * modification, are permitted provided that the following conditions
19: * are met:
20: * 1. Redistributions of source code must retain the above copyright
21: * notice, this list of conditions and the following disclaimer.
22: * 2. Redistributions in binary form must reproduce the above copyright
23: * notice, this list of conditions and the following disclaimer in the
24: * documentation and/or other materials provided with the distribution.
25: * 3. Neither the name of the University nor the names of its contributors
26: * may be used to endorse or promote products derived from this software
27: * without specific prior written permission.
28: *
29: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39: * SUCH DAMAGE.
40: *
41: * @(#)profile.h 8.1 (Berkeley) 6/11/93
42: */
43:
44: /*
45: * Can't use _C_LABEL here.
46: */
47:
48: #ifdef __ELF__
49: #define _MCOUNT_SYM "__mcount"
50: #define _MCOUNT_ENTRY "_mcount"
51: #else
52: #define _MCOUNT_SYM "___mcount"
53: #define _MCOUNT_ENTRY "mcount"
54: #endif
55:
56: #ifdef PIC
57: /* Inline expansion of PICCY_SET() (see <machine/asm.h>). */
58: #define MCOUNT \
59: __asm__(".global " _MCOUNT_ENTRY);\
60: __asm__(".text");\
61: __asm__(_MCOUNT_ENTRY ":");\
62: __asm__("add %o7, 8, %o1");\
63: __asm__("1: call 2f; nop; 2:");\
64: __asm__("add %o7," _MCOUNT_SYM "-1b, %o2");\
65: __asm__("ld [%o2], %o2");\
66: __asm__("jmpl %o2, %g0");\
67: __asm__("add %i7, 8, %o0");
68: #else
69: #define MCOUNT \
70: __asm__(".global " _MCOUNT_ENTRY);\
71: __asm__(".text");\
72: __asm__(_MCOUNT_ENTRY ":");\
73: __asm__("add %i7, 8, %o0");\
74: __asm__("sethi %hi(" _MCOUNT_SYM "), %o2");\
75: __asm__("jmpl %o2 + %lo(" _MCOUNT_SYM "), %g0");\
76: __asm__("add %o7, 8, %o1");
77: #endif
78:
79: #define _MCOUNT_DECL static void __mcount
80:
81: #ifdef _KERNEL
82: /*
83: * Block interrupts during mcount so that those interrupts can also be
84: * counted (as soon as we get done with the current counting). On the
85: * SPARC, we just splhigh/splx as those do not recursively invoke mcount.
86: */
87: #define MCOUNT_ENTER s = splhigh()
88: #define MCOUNT_EXIT splx(s)
89: #endif /* _KERNEL */
CVSweb