]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/i386/IOSharedLockImp.h
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
32 /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
34 * EventShmemLock.h - Shared memory area locks for use between the
35 * WindowServer and the Event Driver.
39 * 29 April 1992 Mike Paquette at NeXT
42 * Multiprocessor locks used within the shared memory area between the
43 * kernel and event system. These must work in both user and kernel mode.
44 * The locks are defined in an include file so they get exported to the local
47 * This is basically a ripoff of the spin locks under the cthreads packages.
50 #ifndef _IOKIT_IOSHAREDLOCKIMP_H
51 #define _IOKIT_IOSHAREDLOCKIMP_H
53 #include <architecture/i386/asm_help.h>
55 // 'Till we're building in kernel
56 .macro DISABLE_PREEMPTION
60 .macro ENABLE_PREEMPTION
70 * Lock the lock pointed to by p. Spin (possibly forever) until the next
82 nop
/* pause for hyperthreaded CPU's */
95 * Unlock the lock pointed to by p.
98 LEAF(_IOSpinUnlock
, 0)
112 * Try to lock p. Return zero if not successful.
115 LEAF(_ev_try_lock
, 0)
116 LEAF(_IOTrySpinLock
, 0)
121 cmpxchgl %ecx
, (%ecx
)
123 movl $
1, %eax
/* yes */
127 xorl %eax
, %eax
/* no */
131 #endif /* ! _IOKIT_IOSHAREDLOCKIMP_H */