1 /* $NetBSD: profile.h,v 1.6 2002/02/07 05:13:35 briggs Exp $ */
4 * Copyright (c) 2000 Tsubai Masanari. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #define _MCOUNT_DECL void __mcount
34 __asm(" .globl _mcount \n" \
35 " .section \".opd\",\"aw\" \n" \
38 " .quad ._mcount,.TOC.@tocbase,0\n" \
40 " .size _mcount,24 \n" \
41 " .type ._mcount,@function \n" \
42 " .globl ._mcount \n" \
46 " stdu 1,-frame(1) \n" \
50 " std 5,48+16(1) \n" \
51 " std 6,48+24(1) \n" \
52 " std 7,48+32(1) \n" \
53 " std 8,48+40(1) \n" \
54 " std 9,48+48(1) \n" \
55 " std 10,48+56(1) \n" \
59 " ld 3,frame+16(1) \n" \
62 " ld 3,frame+16(1) \n" \
75 " addi 1,1,frame \n" \
87 __asm(" .globl _mcount \n" \
88 " .type _mcount,@function \n" \
103 " bl __mcount" _PLT " \n" \
120 " .size _mcount,_mcount_end-_mcount");
125 #define MCOUNT_ENTER \
126 __asm volatile("mfmsr %0" : "=r"(s)); \
127 if ((s & (PSL_IR | PSL_DR)) != (PSL_IR | PSL_DR)) \
130 __asm volatile("mtmsr %0" :: "r"(s & ~PSL_EE))
132 #define MCOUNT_EXIT \
133 __asm volatile("mtmsr %0" :: "r"(s))