xref: /openbsd/sys/arch/powerpc/include/profile.h (revision 78b63d65)
1 /*	$OpenBSD: profile.h,v 1.2 1998/07/04 23:56:14 rahnds Exp $ */
2 
3 /*
4  * Copyright (c) 1998 Dale Rahn. All rights reserved.
5  *
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by Dale Rahn.
18  * 4. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #define	MCOUNT \
33 	__asm__(" \
34 		.section \".text\" \n\
35 		.align 2 \n\
36 		.globl _mcount \n\
37 		.type	_mcount,@function \n\
38 	_mcount: \n\
39 		lwz	11, 4(1) \n\
40 		mflr	0 \n\
41 		stw	0, 4(1) \n\
42 		stwu	1, -48(1) \n\
43 		stw	3, 8(1) \n\
44 		stw	4, 12(1) \n\
45 		stw	5, 16(1) \n\
46 		stw	6, 20(1) \n\
47 		stw	7, 24(1) \n\
48 		stw	8, 28(1) \n\
49 		stw	9, 32(1) \n\
50 		stw	10,36(1) \n\
51 		stw	11,40(1) \n\
52 		mr	4, 0 \n\
53 		mr 	3, 11 \n\
54 		bl __mcount \n\
55 		lwz	3, 8(1) \n\
56 		lwz	4, 12(1) \n\
57 		lwz	5, 16(1) \n\
58 		lwz	6, 20(1) \n\
59 		lwz	7, 24(1) \n\
60 		lwz	8, 28(1) \n\
61 		lwz	9, 32(1) \n\
62 		lwz	10,36(1) \n\
63 		lwz	11,40(1) \n\
64 		addi	1, 1, 48 \n\
65 		lwz	0, 4(1) \n\
66 		mtlr	11 \n\
67 		stw	11, 4(1) \n\
68 		mtctr	0 \n\
69 		bctr \n\
70 	.Lfe2: \n\
71 		.size _mcount, .Lfe2-_mcount \n\
72 	");
73 #define _MCOUNT_DECL static __mcount
74