1 /*-
2 * SPDX-License-Identifier: MIT-CMU
3 *
4 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 *
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
14 *
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
28 *
29 * from: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp
30 * from: FreeBSD: src/sys/alpha/include/profile.h,v 1.4 1999/12/29
31 * $FreeBSD$
32 */
33
34 #ifndef _MACHINE_PROFILE_H_
35 #define _MACHINE_PROFILE_H_
36
37 #define FUNCTION_ALIGNMENT 32
38
39 typedef u_long fptrdiff_t;
40
41 #ifdef _KERNEL
42
43 #include <machine/cpufunc.h>
44
45 #define _MCOUNT_DECL void mcount
46 #define MCOUNT
47
48 #define MCOUNT_DECL(s) register_t s;
49 #define MCOUNT_ENTER(s) {s = intr_disable(); }
50 #define MCOUNT_EXIT(s) {intr_restore(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) : ~0UL)
64
65 void mcount(uintfptr_t frompc, uintfptr_t selfpc);
66
67 #else /* !_KERNEL */
68
69 typedef __uintfptr_t uintfptr_t;
70
71 #define _MCOUNT_DECL void mcount
72 #define MCOUNT
73
74 #endif /* _KERNEL */
75
76 #endif /* !_MACHINE_PROFILE_H_ */
Cache object: a120b6ac4bc9fde2a1c498f20a71bcd9
|