summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_object.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/vm/vm_object.h b/vm/vm_object.h
index 3bfc67a..3c9055f 100644
--- a/vm/vm_object.h
+++ b/vm/vm_object.h
@@ -63,7 +63,7 @@ typedef struct ipc_port * pager_request_t;
struct vm_object {
queue_chain_t memq; /* Resident memory */
- decl_simple_lock_data(, Lock) /* Synchronization */
+ struct lock Lock; /* Synchronization */
#if VM_OBJECT_DEBUG
thread_t LockHolder; /* Thread holding Lock */
#endif /* VM_OBJECT_DEBUG */
@@ -336,14 +336,15 @@ vm_object_t vm_object_copy_delayed(
*/
#if VM_OBJECT_DEBUG
+
#define vm_object_lock_init(object) \
MACRO_BEGIN \
- simple_lock_init(&(object)->Lock); \
+ lock_init(&(object)->Lock, TRUE); \
(object)->LockHolder = 0; \
MACRO_END
#define vm_object_lock(object) \
MACRO_BEGIN \
- simple_lock(&(object)->Lock); \
+ lock_write(&(object)->Lock); \
(object)->LockHolder = current_thread(); \
MACRO_END
#define vm_object_unlock(object) \
@@ -351,10 +352,10 @@ MACRO_BEGIN \
if ((object)->LockHolder != current_thread()) \
panic("vm_object_unlock 0x%x", (object)); \
(object)->LockHolder = 0; \
- simple_unlock(&(object)->Lock); \
+ lock_done(&(object)->Lock); \
MACRO_END
#define vm_object_lock_try(object) \
- (simple_lock_try(&(object)->Lock) \
+ (lock_try_write(&(object)->Lock) \
? ( ((object)->LockHolder = current_thread()) , TRUE) \
: FALSE)
#define vm_object_sleep(event, object, interruptible) \
@@ -362,20 +363,20 @@ MACRO_BEGIN \
if ((object)->LockHolder != current_thread()) \
panic("vm_object_sleep %#x", (object)); \
(object)->LockHolder = 0; \
- thread_sleep((event_t)(event), simple_lock_addr((object)->Lock), \
+ thread_sleep_lock((event_t)(event), &(object)->Lock, \
(interruptible)); \
MACRO_END
#define vm_object_lock_taken(object) \
((object)->LockHolder == current_thread())
#else /* VM_OBJECT_DEBUG */
-#define vm_object_lock_init(object) simple_lock_init(&(object)->Lock)
-#define vm_object_lock(object) simple_lock(&(object)->Lock)
-#define vm_object_unlock(object) simple_unlock(&(object)->Lock)
-#define vm_object_lock_try(object) simple_lock_try(&(object)->Lock)
+#define vm_object_lock_init(object) lock_init(&(object)->Lock, TRUE)
+#define vm_object_lock(object) lock_write(&(object)->Lock)
+#define vm_object_unlock(object) lock_done(&(object)->Lock)
+#define vm_object_lock_try(object) lock_try_write(&(object)->Lock)
#define vm_object_sleep(event, object, interruptible) \
- thread_sleep((event_t)(event), simple_lock_addr((object)->Lock), \
+ thread_sleep_lock((event_t)(event), &(object)->Lock, \
(interruptible))
-#define vm_object_lock_taken(object) simple_lock_taken(&(object)->Lock)
+#define vm_object_lock_taken(object) lock_taken(&(object)->Lock)
#endif /* VM_OBJECT_DEBUG */
/*