]> git.saurik.com Git - apple/xnu.git/blob - osfmk/vm/vm_object.h
xnu-792.25.20.tar.gz
[apple/xnu.git] / osfmk / vm / vm_object.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
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 /*
51 */
52 /*
53 * File: vm_object.h
54 * Author: Avadis Tevanian, Jr., Michael Wayne Young
55 * Date: 1985
56 *
57 * Virtual memory object module definitions.
58 */
59
60 #ifndef _VM_VM_OBJECT_H_
61 #define _VM_VM_OBJECT_H_
62
63 #include <mach_pagemap.h>
64 #include <task_swapper.h>
65
66 #include <mach/kern_return.h>
67 #include <mach/boolean.h>
68 #include <mach/memory_object_types.h>
69 #include <mach/port.h>
70 #include <mach/vm_prot.h>
71 #include <mach/vm_param.h>
72 #include <mach/machine/vm_types.h>
73 #include <kern/queue.h>
74 #include <kern/lock.h>
75 #include <kern/assert.h>
76 #include <kern/misc_protos.h>
77 #include <kern/macro_help.h>
78 #include <ipc/ipc_types.h>
79 #include <vm/pmap.h>
80
81 #if MACH_PAGEMAP
82 #include <vm/vm_external.h>
83 #endif /* MACH_PAGEMAP */
84
85 struct vm_page;
86
87 /*
88 * Types defined:
89 *
90 * vm_object_t Virtual memory object.
91 */
92
93 struct vm_object {
94 queue_head_t memq; /* Resident memory */
95 decl_mutex_data(, Lock) /* Synchronization */
96
97 vm_object_size_t size; /* Object size (only valid
98 * if internal)
99 */
100 struct vm_page *memq_hint;
101 int ref_count; /* Number of references */
102 #if TASK_SWAPPER
103 int res_count; /* Residency references (swap)*/
104 #endif /* TASK_SWAPPER */
105 unsigned int resident_page_count;
106 /* number of resident pages */
107
108 struct vm_object *copy; /* Object that should receive
109 * a copy of my changed pages,
110 * for copy_delay, or just the
111 * temporary object that
112 * shadows this object, for
113 * copy_call.
114 */
115 struct vm_object *shadow; /* My shadow */
116 vm_object_offset_t shadow_offset; /* Offset into shadow */
117
118 memory_object_t pager; /* Where to get data */
119 vm_object_offset_t paging_offset; /* Offset into memory object */
120 memory_object_control_t pager_control; /* Where data comes back */
121
122 memory_object_copy_strategy_t
123 copy_strategy; /* How to handle data copy */
124
125 unsigned int absent_count; /* The number of pages that
126 * have been requested but
127 * not filled. That is, the
128 * number of pages for which
129 * the "absent" attribute is
130 * asserted.
131 */
132
133 int paging_in_progress;
134 /* The memory object ports are
135 * being used (e.g., for pagein
136 * or pageout) -- don't change
137 * any of these fields (i.e.,
138 * don't collapse, destroy or
139 * terminate)
140 */
141 unsigned int
142 /* boolean_t array */ all_wanted:11, /* Bit array of "want to be
143 * awakened" notations. See
144 * VM_OBJECT_EVENT_* items
145 * below */
146 /* boolean_t */ pager_created:1, /* Has pager been created? */
147 /* boolean_t */ pager_initialized:1, /* Are fields ready to use? */
148 /* boolean_t */ pager_ready:1, /* Will pager take requests? */
149
150 /* boolean_t */ pager_trusted:1,/* The pager for this object
151 * is trusted. This is true for
152 * all internal objects (backed
153 * by the default pager)
154 */
155 /* boolean_t */ can_persist:1, /* The kernel may keep the data
156 * for this object (and rights
157 * to the memory object) after
158 * all address map references
159 * are deallocated?
160 */
161 /* boolean_t */ internal:1, /* Created by the kernel (and
162 * therefore, managed by the
163 * default memory manger)
164 */
165 /* boolean_t */ temporary:1, /* Permanent objects may be
166 * changed externally by the
167 * memory manager, and changes
168 * made in memory must be
169 * reflected back to the memory
170 * manager. Temporary objects
171 * lack both of these
172 * characteristics.
173 */
174 /* boolean_t */ private:1, /* magic device_pager object,
175 * holds private pages only */
176 /* boolean_t */ pageout:1, /* pageout object. contains
177 * private pages that refer to
178 * a real memory object. */
179 /* boolean_t */ alive:1, /* Not yet terminated */
180
181 /* boolean_t */ purgable:2, /* Purgable state. See
182 * VM_OBJECT_PURGABLE_*
183 * items below.
184 */
185 /* boolean_t */ shadowed:1, /* Shadow may exist */
186 /* boolean_t */ silent_overwrite:1,
187 /* Allow full page overwrite
188 * without data_request if
189 * page is absent */
190 /* boolean_t */ advisory_pageout:1,
191 /* Instead of sending page
192 * via OOL, just notify
193 * pager that the kernel
194 * wants to discard it, page
195 * remains in object */
196 /* boolean_t */ true_share:1,
197 /* This object is mapped
198 * in more than one place
199 * and hence cannot be
200 * coalesced */
201 /* boolean_t */ terminating:1,
202 /* Allows vm_object_lookup
203 * and vm_object_deallocate
204 * to special case their
205 * behavior when they are
206 * called as a result of
207 * page cleaning during
208 * object termination
209 */
210 /* boolean_t */ named:1, /* An enforces an internal
211 * naming convention, by
212 * calling the right routines
213 * for allocation and
214 * destruction, UBC references
215 * against the vm_object are
216 * checked.
217 */
218 /* boolean_t */ shadow_severed:1,
219 /* When a permanent object
220 * backing a COW goes away
221 * unexpectedly. This bit
222 * allows vm_fault to return
223 * an error rather than a
224 * zero filled page.
225 */
226 /* boolean_t */ phys_contiguous:1,
227 /* Memory is wired and
228 * guaranteed physically
229 * contiguous. However
230 * it is not device memory
231 * and obeys normal virtual
232 * memory rules w.r.t pmap
233 * access bits.
234 */
235 /* boolean_t */ nophyscache:1;
236 /* When mapped at the
237 * pmap level, don't allow
238 * primary caching. (for
239 * I/O)
240 */
241
242
243
244 queue_chain_t cached_list; /* Attachment point for the
245 * list of objects cached as a
246 * result of their can_persist
247 * value
248 */
249
250 queue_head_t msr_q; /* memory object synchronise
251 request queue */
252
253 vm_object_offset_t last_alloc; /* last allocation offset */
254 vm_object_offset_t sequential; /* sequential access size */
255 vm_size_t cluster_size; /* size of paging cluster */
256 #if MACH_PAGEMAP
257 vm_external_map_t existence_map; /* bitmap of pages written to
258 * backing storage */
259 #endif /* MACH_PAGEMAP */
260 vm_offset_t cow_hint; /* last page present in */
261 /* shadow but not in object */
262 #if MACH_ASSERT
263 struct vm_object *paging_object; /* object which pages to be
264 * swapped out are temporary
265 * put in current object
266 */
267 #endif
268 /* hold object lock when altering */
269 unsigned int /* cache WIMG bits */
270 wimg_bits:8, /* wimg plus some expansion*/
271 not_in_use:24;
272 #ifdef UPL_DEBUG
273 queue_head_t uplq; /* List of outstanding upls */
274 #ifdef VM_PIP_DEBUG
275 /*
276 * Keep track of the stack traces for the first holders
277 * of a "paging_in_progress" reference for this VM object.
278 */
279 #define VM_PIP_DEBUG_STACK_FRAMES 25 /* depth of each stack trace */
280 #define VM_PIP_DEBUG_MAX_REFS 10 /* track that many references */
281 struct __pip_backtrace {
282 void *pip_retaddr[VM_PIP_DEBUG_STACK_FRAMES];
283 } pip_holders[VM_PIP_DEBUG_MAX_REFS];
284 #endif /* VM_PIP_DEBUG */
285 #endif /* UPL_DEBUG */
286 };
287
288 #define VM_PAGE_REMOVE(page) \
289 MACRO_BEGIN \
290 vm_page_t __page = (page); \
291 vm_object_t __object = __page->object; \
292 if (__page == __object->memq_hint) { \
293 vm_page_t __new_hint; \
294 queue_entry_t __qe; \
295 __qe = queue_next(&__page->listq); \
296 if (queue_end(&__object->memq, __qe)) { \
297 __qe = queue_prev(&__page->listq); \
298 if (queue_end(&__object->memq, __qe)) { \
299 __qe = NULL; \
300 } \
301 } \
302 __new_hint = (vm_page_t) __qe; \
303 __object->memq_hint = __new_hint; \
304 } \
305 queue_remove(&__object->memq, __page, vm_page_t, listq); \
306 MACRO_END
307
308 #define VM_PAGE_INSERT(page, object) \
309 MACRO_BEGIN \
310 vm_page_t __page = (page); \
311 vm_object_t __object = (object); \
312 queue_enter(&__object->memq, __page, vm_page_t, listq); \
313 __object->memq_hint = __page; \
314 MACRO_END
315
316 __private_extern__
317 vm_object_t kernel_object; /* the single kernel object */
318
319 __private_extern__
320 unsigned int vm_object_absent_max; /* maximum number of absent pages
321 at a time for each object */
322
323 # define VM_MSYNC_INITIALIZED 0
324 # define VM_MSYNC_SYNCHRONIZING 1
325 # define VM_MSYNC_DONE 2
326
327 struct msync_req {
328 queue_chain_t msr_q; /* object request queue */
329 queue_chain_t req_q; /* vm_msync request queue */
330 unsigned int flag;
331 vm_object_offset_t offset;
332 vm_object_size_t length;
333 vm_object_t object; /* back pointer */
334 decl_mutex_data(, msync_req_lock) /* Lock for this structure */
335 };
336
337 typedef struct msync_req *msync_req_t;
338 #define MSYNC_REQ_NULL ((msync_req_t) 0)
339
340 /*
341 * Macros to allocate and free msync_reqs
342 */
343 #define msync_req_alloc(msr) \
344 MACRO_BEGIN \
345 (msr) = (msync_req_t)kalloc(sizeof(struct msync_req)); \
346 mutex_init(&(msr)->msync_req_lock, 0); \
347 msr->flag = VM_MSYNC_INITIALIZED; \
348 MACRO_END
349
350 #define msync_req_free(msr) \
351 (kfree((msr), sizeof(struct msync_req)))
352
353 #define msr_lock(msr) mutex_lock(&(msr)->msync_req_lock)
354 #define msr_unlock(msr) mutex_unlock(&(msr)->msync_req_lock)
355
356 /*
357 * Declare procedures that operate on VM objects.
358 */
359
360 __private_extern__ void vm_object_bootstrap(void);
361
362 __private_extern__ void vm_object_init(void);
363
364 __private_extern__ void vm_object_reaper_init(void);
365
366 __private_extern__ vm_object_t vm_object_allocate(
367 vm_object_size_t size);
368
369 __private_extern__ void _vm_object_allocate(vm_object_size_t size,
370 vm_object_t object);
371
372 #if TASK_SWAPPER
373
374 __private_extern__ void vm_object_res_reference(
375 vm_object_t object);
376 __private_extern__ void vm_object_res_deallocate(
377 vm_object_t object);
378 #define VM_OBJ_RES_INCR(object) (object)->res_count++
379 #define VM_OBJ_RES_DECR(object) (object)->res_count--
380
381 #else /* TASK_SWAPPER */
382
383 #define VM_OBJ_RES_INCR(object)
384 #define VM_OBJ_RES_DECR(object)
385 #define vm_object_res_reference(object)
386 #define vm_object_res_deallocate(object)
387
388 #endif /* TASK_SWAPPER */
389
390 #define vm_object_reference_locked(object) \
391 MACRO_BEGIN \
392 vm_object_t RLObject = (object); \
393 assert((RLObject)->ref_count > 0); \
394 (RLObject)->ref_count++; \
395 vm_object_res_reference(RLObject); \
396 MACRO_END
397
398
399 __private_extern__ void vm_object_reference(
400 vm_object_t object);
401
402 #if !MACH_ASSERT
403
404 #define vm_object_reference(object) \
405 MACRO_BEGIN \
406 vm_object_t RObject = (object); \
407 if (RObject) { \
408 vm_object_lock(RObject); \
409 vm_object_reference_locked(RObject); \
410 vm_object_unlock(RObject); \
411 } \
412 MACRO_END
413
414 #endif /* MACH_ASSERT */
415
416 __private_extern__ void vm_object_deallocate(
417 vm_object_t object);
418
419 __private_extern__ kern_return_t vm_object_release_name(
420 vm_object_t object,
421 int flags);
422
423 __private_extern__ void vm_object_pmap_protect(
424 vm_object_t object,
425 vm_object_offset_t offset,
426 vm_object_size_t size,
427 pmap_t pmap,
428 vm_map_offset_t pmap_start,
429 vm_prot_t prot);
430
431 __private_extern__ void vm_object_page_remove(
432 vm_object_t object,
433 vm_object_offset_t start,
434 vm_object_offset_t end);
435
436 __private_extern__ void vm_object_deactivate_pages(
437 vm_object_t object,
438 vm_object_offset_t offset,
439 vm_object_size_t size,
440 boolean_t kill_page);
441
442 __private_extern__ unsigned int vm_object_purge(
443 vm_object_t object);
444
445 __private_extern__ kern_return_t vm_object_purgable_control(
446 vm_object_t object,
447 vm_purgable_t control,
448 int *state);
449
450 __private_extern__ boolean_t vm_object_coalesce(
451 vm_object_t prev_object,
452 vm_object_t next_object,
453 vm_object_offset_t prev_offset,
454 vm_object_offset_t next_offset,
455 vm_object_size_t prev_size,
456 vm_object_size_t next_size);
457
458 __private_extern__ boolean_t vm_object_shadow(
459 vm_object_t *object,
460 vm_object_offset_t *offset,
461 vm_object_size_t length);
462
463 __private_extern__ void vm_object_collapse(
464 vm_object_t object,
465 vm_object_offset_t offset,
466 boolean_t can_bypass);
467
468 __private_extern__ boolean_t vm_object_copy_quickly(
469 vm_object_t *_object,
470 vm_object_offset_t src_offset,
471 vm_object_size_t size,
472 boolean_t *_src_needs_copy,
473 boolean_t *_dst_needs_copy);
474
475 __private_extern__ kern_return_t vm_object_copy_strategically(
476 vm_object_t src_object,
477 vm_object_offset_t src_offset,
478 vm_object_size_t size,
479 vm_object_t *dst_object,
480 vm_object_offset_t *dst_offset,
481 boolean_t *dst_needs_copy);
482
483 __private_extern__ kern_return_t vm_object_copy_slowly(
484 vm_object_t src_object,
485 vm_object_offset_t src_offset,
486 vm_object_size_t size,
487 int interruptible,
488 vm_object_t *_result_object);
489
490 __private_extern__ vm_object_t vm_object_copy_delayed(
491 vm_object_t src_object,
492 vm_object_offset_t src_offset,
493 vm_object_size_t size);
494
495
496
497 __private_extern__ kern_return_t vm_object_destroy(
498 vm_object_t object,
499 kern_return_t reason);
500
501 __private_extern__ void vm_object_pager_create(
502 vm_object_t object);
503
504 __private_extern__ void vm_object_page_map(
505 vm_object_t object,
506 vm_object_offset_t offset,
507 vm_object_size_t size,
508 vm_object_offset_t (*map_fn)
509 (void *, vm_object_offset_t),
510 void *map_fn_data);
511
512 __private_extern__ kern_return_t vm_object_upl_request(
513 vm_object_t object,
514 vm_object_offset_t offset,
515 upl_size_t size,
516 upl_t *upl,
517 upl_page_info_t *page_info,
518 unsigned int *count,
519 int flags);
520
521 __private_extern__ kern_return_t vm_object_transpose(
522 vm_object_t object1,
523 vm_object_t object2,
524 vm_object_size_t transpose_size);
525
526 __private_extern__ boolean_t vm_object_sync(
527 vm_object_t object,
528 vm_object_offset_t offset,
529 vm_object_size_t size,
530 boolean_t should_flush,
531 boolean_t should_return,
532 boolean_t should_iosync);
533
534 __private_extern__ kern_return_t vm_object_update(
535 vm_object_t object,
536 vm_object_offset_t offset,
537 vm_object_size_t size,
538 vm_object_offset_t *error_offset,
539 int *io_errno,
540 memory_object_return_t should_return,
541 int flags,
542 vm_prot_t prot);
543
544 __private_extern__ kern_return_t vm_object_lock_request(
545 vm_object_t object,
546 vm_object_offset_t offset,
547 vm_object_size_t size,
548 memory_object_return_t should_return,
549 int flags,
550 vm_prot_t prot);
551
552
553
554 __private_extern__ vm_object_t vm_object_enter(
555 memory_object_t pager,
556 vm_object_size_t size,
557 boolean_t internal,
558 boolean_t init,
559 boolean_t check_named);
560
561
562 /*
563 * Purgable object state.
564 */
565
566 #define VM_OBJECT_NONPURGABLE 0 /* not a purgable object */
567 #define VM_OBJECT_PURGABLE_NONVOLATILE 1 /* non-volatile purgable object */
568 #define VM_OBJECT_PURGABLE_VOLATILE 2 /* volatile (but intact) purgable object */
569 #define VM_OBJECT_PURGABLE_EMPTY 3 /* volatile purgable object that has been emptied */
570
571 __private_extern__ kern_return_t vm_object_populate_with_private(
572 vm_object_t object,
573 vm_object_offset_t offset,
574 ppnum_t phys_page,
575 vm_size_t size);
576
577 extern kern_return_t adjust_vm_object_cache(
578 vm_size_t oval,
579 vm_size_t nval);
580
581 extern kern_return_t vm_object_page_op(
582 vm_object_t object,
583 vm_object_offset_t offset,
584 int ops,
585 ppnum_t *phys_entry,
586 int *flags);
587
588 extern kern_return_t vm_object_range_op(
589 vm_object_t object,
590 vm_object_offset_t offset_beg,
591 vm_object_offset_t offset_end,
592 int ops,
593 int *range);
594
595 /*
596 * Event waiting handling
597 */
598
599 #define VM_OBJECT_EVENT_INITIALIZED 0
600 #define VM_OBJECT_EVENT_PAGER_READY 1
601 #define VM_OBJECT_EVENT_PAGING_IN_PROGRESS 2
602 #define VM_OBJECT_EVENT_ABSENT_COUNT 3
603 #define VM_OBJECT_EVENT_LOCK_IN_PROGRESS 4
604 #define VM_OBJECT_EVENT_UNCACHING 5
605 #define VM_OBJECT_EVENT_COPY_CALL 6
606 #define VM_OBJECT_EVENT_CACHING 7
607
608 #define vm_object_assert_wait(object, event, interruptible) \
609 (((object)->all_wanted |= 1 << (event)), \
610 assert_wait((event_t)((vm_offset_t)(object)+(event)),(interruptible)))
611
612 #define vm_object_wait(object, event, interruptible) \
613 (vm_object_assert_wait((object),(event),(interruptible)), \
614 vm_object_unlock(object), \
615 thread_block(THREAD_CONTINUE_NULL)) \
616
617 #define thread_sleep_vm_object(object, event, interruptible) \
618 thread_sleep_mutex((event_t)(event), &(object)->Lock, (interruptible))
619
620 #define vm_object_sleep(object, event, interruptible) \
621 (((object)->all_wanted |= 1 << (event)), \
622 thread_sleep_vm_object((object), \
623 ((vm_offset_t)(object)+(event)), (interruptible)))
624
625 #define vm_object_wakeup(object, event) \
626 MACRO_BEGIN \
627 if ((object)->all_wanted & (1 << (event))) \
628 thread_wakeup((event_t)((vm_offset_t)(object) + (event))); \
629 (object)->all_wanted &= ~(1 << (event)); \
630 MACRO_END
631
632 #define vm_object_set_wanted(object, event) \
633 MACRO_BEGIN \
634 ((object)->all_wanted |= (1 << (event))); \
635 MACRO_END
636
637 #define vm_object_wanted(object, event) \
638 ((object)->all_wanted & (1 << (event)))
639
640 /*
641 * Routines implemented as macros
642 */
643 #ifdef VM_PIP_DEBUG
644 extern unsigned OSBacktrace(void **bt, unsigned maxAddrs);
645 #define VM_PIP_DEBUG_BEGIN(object) \
646 MACRO_BEGIN \
647 if ((object)->paging_in_progress < VM_PIP_DEBUG_MAX_REFS) { \
648 int pip = (object)->paging_in_progress; \
649 (void) OSBacktrace(&(object)->pip_holders[pip].retaddr[0], \
650 VM_PIP_DEBUG_STACK_FRAMES); \
651 } \
652 MACRO_END
653 #else /* VM_PIP_DEBUG */
654 #define VM_PIP_DEBUG_BEGIN(object)
655 #endif /* VM_PIP_DEBUG */
656
657 #define vm_object_paging_begin(object) \
658 MACRO_BEGIN \
659 assert((object)->paging_in_progress >= 0); \
660 VM_PIP_DEBUG_BEGIN((object)); \
661 (object)->paging_in_progress++; \
662 MACRO_END
663
664 #define vm_object_paging_end(object) \
665 MACRO_BEGIN \
666 assert((object)->paging_in_progress > 0); \
667 if (--(object)->paging_in_progress == 0) { \
668 vm_object_wakeup(object, \
669 VM_OBJECT_EVENT_PAGING_IN_PROGRESS); \
670 } \
671 MACRO_END
672
673 #define vm_object_paging_wait(object, interruptible) \
674 MACRO_BEGIN \
675 while ((object)->paging_in_progress != 0) { \
676 wait_result_t _wr; \
677 \
678 _wr = vm_object_sleep((object), \
679 VM_OBJECT_EVENT_PAGING_IN_PROGRESS, \
680 (interruptible)); \
681 \
682 /*XXX if ((interruptible) && (_wr != THREAD_AWAKENED))*/\
683 /*XXX break; */ \
684 } \
685 MACRO_END
686
687 #define vm_object_absent_assert_wait(object, interruptible) \
688 MACRO_BEGIN \
689 vm_object_assert_wait( (object), \
690 VM_OBJECT_EVENT_ABSENT_COUNT, \
691 (interruptible)); \
692 MACRO_END
693
694
695 #define vm_object_absent_release(object) \
696 MACRO_BEGIN \
697 (object)->absent_count--; \
698 vm_object_wakeup((object), \
699 VM_OBJECT_EVENT_ABSENT_COUNT); \
700 MACRO_END
701
702 /*
703 * Object locking macros
704 */
705
706 #define vm_object_lock_init(object) mutex_init(&(object)->Lock, 0)
707 #define vm_object_lock(object) mutex_lock(&(object)->Lock)
708 #define vm_object_unlock(object) mutex_unlock(&(object)->Lock)
709 #define vm_object_lock_try(object) mutex_try(&(object)->Lock)
710
711 #define vm_object_round_page(x) (((vm_object_offset_t)(x) + PAGE_MASK) & ~((signed)PAGE_MASK))
712 #define vm_object_trunc_page(x) ((vm_object_offset_t)(x) & ~((signed)PAGE_MASK))
713
714 #endif /* _VM_VM_OBJECT_H_ */