xref: /titanic_51/usr/src/uts/sparc/sys/synch32.h (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_SYNCH32_H
28 #define	_SYS_SYNCH32_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* special defines for LWP mutexes */
37 #define	mutex_flag		flags.flag1
38 #define	mutex_ceiling		flags.ceiling
39 #define	mutex_type		flags.mbcp_type_un.mtype_rcount.count_type2
40 #define	mutex_rcount		flags.mbcp_type_un.mtype_rcount.count_type1
41 #define	mutex_magic		flags.magic
42 #define	mutex_owner		data
43 /* used to atomically operate on whole word via cas or swap instruction */
44 #define	mutex_lockword		lock.lock32.lockword /* address of */
45 #define	mutex_lockw		lock.lock64.pad[4]
46 #define	mutex_waiters		lock.lock64.pad[7]
47 
48 /* process-shared lock owner pid */
49 #define	mutex_ownerpid		lock.lock32.ownerpid
50 
51 /* Max. recusrion count for recursive mutexes */
52 #define	RECURSION_MAX		255
53 
54 /* special defines for LWP condition variables */
55 #define	cond_type		flags.type
56 #define	cond_magic		flags.magic
57 #define	cond_clockid		flags.flag[1]
58 #define	cond_waiters_user	flags.flag[2]
59 #define	cond_waiters_kernel	flags.flag[3]
60 
61 /* special defines for LWP semaphores */
62 #define	sema_count		count
63 #define	sema_type		type
64 #define	sema_waiters		flags[7]
65 
66 /* special defines for LWP rwlocks */
67 #define	rwlock_readers		readers
68 #define	rwlock_type		type
69 #define	rwlock_magic		magic
70 #define	rwlock_mwaiters		mutex.mutex_waiters
71 #define	rwlock_mlockw		mutex.mutex_lockw
72 #define	rwlock_mowner		mutex.mutex_owner
73 #define	rwlock_mownerpid	mutex.mutex_ownerpid
74 #define	rwlock_owner		readercv.data
75 #define	rwlock_ownerpid		writercv.data
76 
77 #define	URW_HAS_WAITERS		0x80000000
78 #define	URW_WRITE_WANTED	0x40000000
79 #define	URW_WRITE_LOCKED	0x20000000
80 #define	URW_READERS_MASK	0x1fffffff
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif /* _SYS_SYNCH32_H */
87