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