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