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