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