]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/simple_lock.h
xnu-792.10.96.tar.gz
[apple/xnu.git] / osfmk / i386 / simple_lock.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
37839358
A
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.
e5568f75 11 *
37839358
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
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.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
25/*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
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.
35 *
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.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50/*
91447636
A
51 * File: kern/simple_lock_types.h
52 * Author: Avadis Tevanian, Jr., Michael Wayne Young
53 * Date: 1985
54 *
55 * Simple lock data type definitions
1c79356b 56 */
91447636 57#ifdef KERNEL_PRIVATE
1c79356b 58
91447636
A
59#ifndef _I386_SIMPLE_LOCK_TYPES_H_
60#define _I386_SIMPLE_LOCK_TYPES_H_
1c79356b
A
61
62#include <mach/boolean.h>
1c79356b
A
63#include <kern/kern_types.h>
64
9bccf70c 65#include <sys/appleapiopts.h>
91447636
A
66#if defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE)
67#include <i386/hw_lock_types.h>
68#include <mach_ldebug.h>
69#endif
70
71#if defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE)
72
73#if MACH_LDEBUG
74#define USLOCK_DEBUG 1
75#else
76#define USLOCK_DEBUG 0
77#endif /* USLOCK_DEBUG */
78
79typedef 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];
83 unsigned short state;
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 */
88} uslock_debug;
9bccf70c 89
91447636
A
90typedef 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
94 uslock_debug debug;
95} usimple_lock_data_t, *usimple_lock_t;
9bccf70c 96
91447636 97#else
1c79356b 98
91447636
A
99typedef struct slock {
100 unsigned int lock_data[10];
101} usimple_lock_data_t, *usimple_lock_t;
1c79356b 102
91447636 103#endif /* defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE) */
1c79356b 104
91447636 105#define USIMPLE_LOCK_NULL ((usimple_lock_t) 0)
0b4e3aa0 106
91447636
A
107#if !defined(decl_simple_lock_data)
108typedef usimple_lock_data_t *simple_lock_t;
109typedef usimple_lock_data_t simple_lock_data_t;
1c79356b 110
91447636
A
111#define decl_simple_lock_data(class,name) \
112 class simple_lock_data_t name;
1c79356b 113
91447636 114#endif /* !defined(decl_simple_lock_data) */
0b4e3aa0 115
91447636 116#endif /* !_I386_SIMPLE_LOCK_TYPES_H_ */
9bccf70c 117
91447636 118#endif /* KERNEL_PRIVATE */