2 * Copyright (c) 2000 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 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
51 * File: kern/simple_lock_types.h
52 * Author: Avadis Tevanian, Jr., Michael Wayne Young
55 * Simple lock data type definitions
59 #ifndef _I386_SIMPLE_LOCK_TYPES_H_
60 #define _I386_SIMPLE_LOCK_TYPES_H_
62 #include <mach/boolean.h>
63 #include <kern/kern_types.h>
65 #include <sys/appleapiopts.h>
66 #if defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE)
67 #include <i386/hw_lock_types.h>
68 #include <mach_ldebug.h>
71 #if defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE)
74 #define USLOCK_DEBUG 1
76 #define USLOCK_DEBUG 0
77 #endif /* USLOCK_DEBUG */
79 typedef struct uslock_debug
{
80 void *lock_pc
; /* pc where lock operation began */
81 void *lock_thread
; /* thread that acquired lock */
82 unsigned long duration
[2];
84 unsigned char lock_cpu
;
85 void *unlock_thread
; /* last thread to release lock */
86 unsigned char unlock_cpu
;
87 void *unlock_pc
; /* pc where lock operation ended */
90 typedef struct slock
{
91 hw_lock_data_t interlock
; /* must be first... see lock.c */
92 unsigned short lock_type
; /* must be second... see lock.c */
93 #define USLOCK_TAG 0x5353
95 } usimple_lock_data_t
, *usimple_lock_t
;
99 typedef struct slock
{
100 unsigned int lock_data
[10];
101 } usimple_lock_data_t
, *usimple_lock_t
;
103 #endif /* defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE) */
105 #define USIMPLE_LOCK_NULL ((usimple_lock_t) 0)
107 #if !defined(decl_simple_lock_data)
108 typedef usimple_lock_data_t
*simple_lock_t
;
109 typedef usimple_lock_data_t simple_lock_data_t
;
111 #define decl_simple_lock_data(class,name) \
112 class simple_lock_data_t name;
114 #endif /* !defined(decl_simple_lock_data) */
116 #endif /* !_I386_SIMPLE_LOCK_TYPES_H_ */
118 #endif /* KERNEL_PRIVATE */