2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
26 #include <kern/kern_types.h>
27 #ifdef MACH_KERNEL_PRIVATE
28 #include <ppc/hw_lock_types.h>
32 #ifdef MACH_KERNEL_PRIVATE
34 extern unsigned int LcksOpts
;
36 #define enaLkDeb 0x00000001 /* Request debug in default attribute */
37 #define enaLkStat 0x00000002 /* Request statistic in default attribute */
39 #define disLkType 0x80000000 /* Disable type checking */
41 #define disLkThread 0x40000000 /* Disable ownership checking */
42 #define disLkThreadb 1
43 #define enaLkExtStck 0x20000000 /* Enable extended backtrace */
44 #define enaLkExtStckb 2
45 #define disLkMyLck 0x10000000 /* Disable recursive lock dectection */
50 #ifdef MACH_KERNEL_PRIVATE
52 unsigned int interlock
;
53 unsigned int lck_spin_pad4
[2];
56 #define LCK_SPIN_TAG_DESTROYED 0x00002007 /* lock marked as Destroyed */
61 unsigned int opaque
[3];
64 typedef struct __lck_spin_t__ lck_spin_t
;
68 #ifdef MACH_KERNEL_PRIVATE
69 typedef struct _lck_mtx_
{
72 unsigned int lck_mtxd_data
;
73 unsigned short lck_mtxd_waiters
;
74 unsigned short lck_mtxd_pri
;
75 unsigned int lck_mtxd_pad8
;
78 unsigned int lck_mtxi_tag
;
79 struct _lck_mtx_ext_
*lck_mtxi_ptr
;
80 unsigned int lck_mtxi_pad8
;
85 #define lck_mtx_data lck_mtx_sw.lck_mtxd.lck_mtxd_data
86 #define lck_mtx_waiters lck_mtx_sw.lck_mtxd.lck_mtxd_waiters
87 #define lck_mtx_pri lck_mtx_sw.lck_mtxd.lck_mtxd_pri
89 #define lck_mtx_tag lck_mtx_sw.lck_mtxi.lck_mtxi_tag
90 #define lck_mtx_ptr lck_mtx_sw.lck_mtxi.lck_mtxi_ptr
92 #define LCK_MTX_TAG_INDIRECT 0x00001007 /* lock marked as Indirect */
93 #define LCK_MTX_TAG_DESTROYED 0x00002007 /* lock marked as Destroyed */
95 #define LCK_FRAMES_MAX 8
99 vm_offset_t stack
[LCK_FRAMES_MAX
];
103 #define MUTEX_TAG 0x4d4d
106 unsigned int lck_mtx_stat_data
;
109 typedef struct _lck_mtx_ext_
{
111 struct _lck_grp_
*lck_mtx_grp
;
112 unsigned int lck_mtx_attr
;
113 lck_mtx_deb_t lck_mtx_deb
;
114 lck_mtx_stat_t lck_mtx_stat
;
117 #define LCK_MTX_ATTR_DEBUG 0x1
118 #define LCK_MTX_ATTR_DEBUGb 31
119 #define LCK_MTX_ATTR_STAT 0x2
120 #define LCK_MTX_ATTR_STATb 30
123 #ifdef KERNEL_PRIVATE
125 unsigned int opaque
[3];
128 typedef struct __lck_mtx_t__ lck_mtx_t
;
132 #ifdef MACH_KERNEL_PRIVATE
136 unsigned int lck_rwd_shared_cnt
:16, /* No. of shared granted request */
137 lck_rwd_pad16
:12, /* padding */
138 lck_rwd_want_excl
:1, /* Writer is waiting, or locked for write */
139 lck_rwd_want_upgrade
:1, /* Read-to-write upgrade waiting */
140 lck_rwd_waiting
:1, /* Someone is sleeping on lock */
141 lck_rwd_interlock
:1; /* Read-to-write upgrade waiting */
142 unsigned int lck_rwd_pad4
;
143 unsigned int lck_rwd_pad8
;
146 unsigned int lck_rwi_tag
;
147 struct _lck_rw_ext_
*lck_rwi_ptr
;
148 unsigned int lck_rwi_pad8
;
153 #define lck_rw_interlock lck_rw_sw.lck_rwd.lck_rwd_interlock
154 #define lck_rw_want_upgrade lck_rw_sw.lck_rwd.lck_rwd_want_upgrade
155 #define lck_rw_want_excl lck_rw_sw.lck_rwd.lck_rwd_want_excl
156 #define lck_rw_waiting lck_rw_sw.lck_rwd.lck_rwd_waiting
157 #define lck_rw_shared_cnt lck_rw_sw.lck_rwd.lck_rwd_shared_cnt
159 #define lck_rw_tag lck_rw_sw.lck_rwi.lck_rwi_tag
160 #define lck_rw_ptr lck_rw_sw.lck_rwi.lck_rwi_ptr
164 vm_offset_t stack
[LCK_FRAMES_MAX
];
166 void (*pc_excl
)(void);
167 void (*pc_done
)(void);
170 #define RW_TAG 0x5d5d
173 unsigned int lck_rw_stat_data
;
176 typedef struct _lck_rw_ext_
{
178 struct _lck_grp_
*lck_rw_grp
;
179 unsigned int lck_rw_attr
;
180 lck_rw_deb_t lck_rw_deb
;
181 lck_rw_stat_t lck_rw_stat
;
184 #define LCK_RW_ATTR_DEBUG 0x1
185 #define LCK_RW_ATTR_DEBUGb 31
186 #define LCK_RW_ATTR_STAT 0x2
187 #define LCK_RW_ATTR_STATb 30
188 #define LCK_RW_ATTR_DIS_THREAD 0x40000000
189 #define LCK_RW_ATTR_DIS_THREADb 1
190 #define LCK_RW_ATTR_DIS_MYLOCK 0x10000000
191 #define LCK_RW_ATTR_DIS_MYLOCKb 3
193 #define LCK_RW_TAG_INDIRECT 0x00001107 /* lock marked as Indirect */
194 #define LCK_RW_TAG_DESTROYED 0x00002107 /* lock marked as Destroyed */
197 #ifdef KERNEL_PRIVATE
199 unsigned int opaque
[3];
202 typedef struct __lck_rw_t__ lck_rw_t
;
206 #endif /* _PPC_LOCKS_H_ */