/*
- * Copyright (c) 2019 Apple Inc. All rights reserved.
+ * Copyright (c) 2014-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
*/
int fourk_pager_count = 0; /* number of pagers */
int fourk_pager_count_mapped = 0; /* number of unmapped pagers */
-queue_head_t fourk_pager_queue;
-decl_lck_mtx_data(, fourk_pager_lock);
+queue_head_t fourk_pager_queue = QUEUE_HEAD_INITIALIZER(fourk_pager_queue);
+LCK_GRP_DECLARE(fourk_pager_lck_grp, "4K-pager");
+LCK_MTX_DECLARE(fourk_pager_lock, &fourk_pager_lck_grp);
/*
* Maximum number of unmapped pagers we're willing to keep around.
int fourk_pager_num_trim_max = 0;
int fourk_pager_num_trim_total = 0;
-
-lck_grp_t fourk_pager_lck_grp;
-lck_grp_attr_t fourk_pager_lck_grp_attr;
-lck_attr_t fourk_pager_lck_attr;
-
-
/* internal prototypes */
fourk_pager_t fourk_pager_lookup(memory_object_t mem_obj);
void fourk_pager_dequeue(fourk_pager_t pager);
#endif
-void
-fourk_pager_bootstrap(void)
-{
- lck_grp_attr_setdefault(&fourk_pager_lck_grp_attr);
- lck_grp_init(&fourk_pager_lck_grp, "4K-pager", &fourk_pager_lck_grp_attr);
- lck_attr_setdefault(&fourk_pager_lck_attr);
- lck_mtx_init(&fourk_pager_lock, &fourk_pager_lck_grp, &fourk_pager_lck_attr);
- queue_init(&fourk_pager_queue);
-}
-
/*
* fourk_pager_init()
*
if (vm_page_wait(interruptible)) {
goto retry_src_fault;
}
- /* fall thru */
+ OS_FALLTHROUGH;
case VM_FAULT_INTERRUPTED:
retval = MACH_SEND_INTERRUPTED;
goto src_fault_done;
/* success but no VM page: fail */
vm_object_paging_end(src_object);
vm_object_unlock(src_object);
- /*FALLTHROUGH*/
+ OS_FALLTHROUGH;
case VM_FAULT_MEMORY_ERROR:
/* the page is not there! */
if (error_code) {
/* a tainted subpage taints entire 16K page */
UPL_SET_CS_TAINTED(upl_pl,
cur_offset / PAGE_SIZE,
- TRUE);
+ VMP_CS_ALL_TRUE);
/* also mark as "validated" for consisteny */
UPL_SET_CS_VALIDATED(upl_pl,
cur_offset / PAGE_SIZE,
- TRUE);
+ VMP_CS_ALL_TRUE);
} else if (num_subpg_validated == num_subpg_signed) {
/*
* All the code-signed 4K subpages of this
*/
UPL_SET_CS_VALIDATED(upl_pl,
cur_offset / PAGE_SIZE,
- TRUE);
+ VMP_CS_ALL_TRUE);
}
if (num_subpg_nx > 0) {
UPL_SET_CS_NX(upl_pl,
cur_offset / PAGE_SIZE,
- TRUE);
+ VMP_CS_ALL_TRUE);
}
}
}
}
} else {
boolean_t empty;
- upl_commit_range(upl, 0, upl->size,
+ assertf(page_aligned(upl->u_offset) && page_aligned(upl->u_size),
+ "upl %p offset 0x%llx size 0x%x",
+ upl, upl->u_offset, upl->u_size);
+ upl_commit_range(upl, 0, upl->u_size,
UPL_COMMIT_CS_VALIDATED | UPL_COMMIT_WRITTEN_BY_KERNEL,
upl_pl, pl_count, &empty);
}