]> git.saurik.com Git - apple/xnu.git/blob - osfmk/profiling/ppc/profile-md.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / osfmk / profiling / ppc / profile-md.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_COPYRIGHT@
25 *
26 */
27 /*
28 * HISTORY
29 *
30 * Revision 1.1.1.1 1998/09/22 21:05:49 wsanchez
31 * Import of Mac OS X kernel (~semeria)
32 *
33 * Revision 1.1.1.1 1998/03/07 02:26:08 wsanchez
34 * Import of OSF Mach kernel (~mburg)
35 *
36 * Revision 1.1.8.1 1996/12/09 16:57:22 stephen
37 * nmklinux_1.0b3_shared into pmk1.1
38 * [1996/12/09 11:13:16 stephen]
39 *
40 * Revision 1.1.6.1 1996/04/11 11:20:35 emcmanus
41 * Copied from mainline.ppc.
42 * [1996/04/11 08:26:36 emcmanus]
43 *
44 * hppa merge
45 * [1995/03/15 09:47:27 bruel]
46 *
47 * Revision 1.1.4.1 1995/11/23 17:37:28 stephen
48 * first powerpc checkin to mainline.ppc
49 * [1995/11/23 16:46:29 stephen]
50 *
51 * Revision 1.1.2.1 1995/08/25 06:50:17 stephen
52 * Initial checkin of files for PowerPC port
53 * [1995/08/23 15:05:31 stephen]
54 *
55 * Revision 1.1.2.1 1995/02/14 14:25:16 bruel
56 * First Revision.
57 * [95/01/27 bruel]
58 *
59 * $EndLog$
60 */
61
62 #ifndef _PROFILE_MD_H
63 #define _PROFILE_MD_H
64
65 /*
66 * Define the interfaces between the assembly language profiling support
67 * that is common between the kernel, mach servers, and user space library.
68 */
69
70 /*
71 * Integer types used.
72 */
73
74 typedef long prof_ptrint_t; /* hold either pointer or signed int */
75 typedef unsigned long prof_uptrint_t; /* hold either pointer or unsigned int */
76 typedef long prof_lock_t; /* lock word type */
77 typedef unsigned char prof_flag_t; /* type for boolean flags */
78
79 /*
80 * Double precision counter.
81 */
82
83 typedef struct prof_cnt_t {
84 prof_uptrint_t low; /* low 32 bits of counter */
85 prof_uptrint_t high; /* high 32 bits of counter */
86 } prof_cnt_t;
87
88 #define PROF_CNT_INC(cnt) ((++((cnt).low) == 0) ? ++((cnt).high) : 0)
89 #define PROF_CNT_ADD(cnt,val) (((((cnt).low + (val)) < (val)) ? ((cnt).high++) : 0), ((cnt).low += (val)))
90 #define PROF_CNT_LADD(cnt,val) (PROF_CNT_ADD(cnt,(val).low), (cnt).high += (val).high)
91 #define PROF_CNT_SUB(cnt,val) (((((cnt).low - (val)) > (cnt).low) ? ((cnt).high--) : 0), ((cnt).low -= (val)))
92 #define PROF_CNT_LSUB(cnt,val) (PROF_CNT_SUB(cnt,(val).low), (cnt).high -= (val).high)
93
94 #define LPROF_ULONG_TO_CNT(cnt,val) PROF_ULONG_TO_CNT(cnt,val)
95 #define LPROF_CNT_INC(lp) PROF_CNT_INC(lp)
96 #define LPROF_CNT_ADD(lp,val) PROF_CNT_ADD(lp,val)
97 #define LPROF_CNT_LADD(lp,val) PROF_CNT_LADD(lp,val)
98 #define LPROF_CNT_SUB(lp,val) PROF_CNT_SUB(lp,val)
99 #define LPROF_CNT_LSUB(lp,val) PROF_CNT_LSUB(lp,val)
100 #define LPROF_CNT_OVERFLOW(lp,high,low) PROF_CNT_OVERFLOW(lp,high,low)
101 #define LPROF_CNT_TO_ULONG(lp) PROF_CNT_TO_ULONG(lp)
102 #define LPROF_CNT_TO_LDOUBLE(lp) PROF_CNT_TO_LDOUBLE(lp)
103 #define LPROF_CNT_TO_DECIMAL(buf,cnt) PROF_CNT_TO_DECIMAL(buf,cnt)
104 #define LPROF_CNT_EQ_0(cnt) PROF_CNT_EQ_0(cnt)
105 #define LPROF_CNT_NE_0(cnt) PROF_CNT_NE_0(cnt)
106 #define LPROF_CNT_EQ(cnt1,cnt2) PROF_CNT_EQ(cnt1,cnt2)
107 #define LPROF_CNT_NE(cnt1,cnt2) PROF_CNT_NE(cnt1,cnt2)
108 #define LPROF_CNT_GT(cnt1,cnt2) PROF_CNT_GT(cnt1,cnt2)
109 #define LPROF_CNT_LT(cnt1,cnt2) PROF_CNT_LT(cnt1,cnt2)
110 #define LPROF_CNT_DIGITS PROF_CNT_DIGITS
111
112
113 /*
114 * Types of the profil counter.
115 */
116
117 typedef unsigned short HISTCOUNTER; /* profil */
118 typedef prof_cnt_t LHISTCOUNTER; /* lprofil */
119
120 struct profile_stats { /* Debugging counters */
121 prof_uptrint_t major_version; /* major version number */
122 prof_uptrint_t minor_version; /* minor version number */
123 };
124
125 struct profile_md {
126 int major_version; /* major version number */
127 int minor_version; /* minor version number */
128 };
129
130 #define PROFILE_MAJOR_VERSION 1
131 #define PROFILE_MINOR_VERSION 1
132
133 #endif /* _PROFILE_MD_H */
134
135
136
137
138
139