xref: /freebsd/sys/powerpc/include/profile.h (revision 262e143bd46171a6415a5b28af260a5efa2a3db8)
1 /*-
2  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
3  * All rights reserved.
4  *
5  * Author: Chris G. Demetriou
6  *
7  * Permission to use, copy, modify and distribute this software and
8  * its documentation is hereby granted, provided that both the copyright
9  * notice and this permission notice appear in all copies of the
10  * software, derivative works or modified versions, and any portions
11  * thereof, and that both notices appear in supporting documentation.
12  *
13  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
15  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16  *
17  * Carnegie Mellon requests users of this software to return to
18  *
19  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
20  *  School of Computer Science
21  *  Carnegie Mellon University
22  *  Pittsburgh PA 15213-3890
23  *
24  * any improvements or extensions that they make and grant Carnegie the
25  * rights to redistribute these changes.
26  *
27  *	from: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp
28  *	from: FreeBSD: src/sys/alpha/include/profile.h,v 1.4 1999/12/29
29  * $FreeBSD$
30  */
31 
32 #ifndef _MACHINE_PROFILE_H_
33 #define	_MACHINE_PROFILE_H_
34 
35 #define	_MCOUNT_DECL	void mcount
36 
37 #define FUNCTION_ALIGNMENT 16
38 
39 typedef u_int	fptrdiff_t;
40 
41 #define	MCOUNT \
42 void \
43 _mcount() \
44 { \
45 }
46 
47 #ifdef _KERNEL
48 #define MCOUNT_ENTER(s)
49 #define MCOUNT_EXIT(s)
50 #define	MCOUNT_DECL(s)
51 
52 void bintr(void);
53 void btrap(void);
54 void eintr(void);
55 void user(void);
56 
57 #define	MCOUNT_FROMPC_USER(pc)					\
58 	((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc)
59 
60 #define	MCOUNT_FROMPC_INTR(pc)					\
61 	((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ?	\
62 	    ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr :	\
63 		(uintfptr_t)btrap) : ~0U)
64 
65 
66 #else	/* !_KERNEL */
67 
68 typedef u_int	uintfptr_t;
69 
70 #endif	/* _KERNEL */
71 
72 #endif /* !_MACHINE_PROFILE_H_ */
73