]>
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 * 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@
23 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
29 /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
31 * EventShmemLock.h - Shared memory area locks for use between the
32 * WindowServer and the Event Driver.
36 * 29 April 1992 Mike Paquette at NeXT
39 * Multiprocessor locks used within the shared memory area between the
40 * kernel and event system. These must work in both user and kernel mode.
41 * The locks are defined in an include file so they get exported to the local
44 * This is basically a ripoff of the spin locks under the cthreads packages.
47 #ifndef _IOKIT_IOSHAREDLOCKIMP_H
48 #define _IOKIT_IOSHAREDLOCKIMP_H
50 #include <architecture/i386/asm_help.h>
52 // 'Till we're building in kernel
53 .macro DISABLE_PREEMPTION
57 .macro ENABLE_PREEMPTION
67 * Lock the lock pointed to by p. Spin (possibly forever) until the next
93 * Unlock the lock pointed to by p.
96 LEAF(_IOSpinUnlock
, 0)
111 * Try to lock p. Return zero if not successful.
114 LEAF(_ev_try_lock
, 0)
115 LEAF(_IOTrySpinLock
, 0)
120 movl $
1, %eax
/* yes */
124 xorl %eax
, %eax
/* no */
128 #endif /* ! _IOKIT_IOSHAREDLOCKIMP_H */