- PAGER_DEBUG(PAGER_PAGEIN, ("apple_protect_pager_data_request: %x, %llx, %llx, %x, pager %x\n", mem_obj, offset, length, protection_required, pager));
-
- /*
- * Map the encrypted data in the kernel address space from the
- * backing VM object (itself backed by the encrypted file via
- * the vnode pager).
- */
- src_object = pager->backing_object;
- assert(src_object != VM_OBJECT_NULL);
- vm_object_reference(src_object); /* ref. for the mapping */
- src_mapping = 0;
- kr = vm_map_enter(kernel_map,
- &src_mapping,
- length,
- 0,
- VM_FLAGS_ANYWHERE,
- src_object,
- offset,
- FALSE,
- VM_PROT_READ,
- VM_PROT_READ,
- VM_INHERIT_NONE);
- switch (kr) {
- case KERN_SUCCESS:
- /* wire the memory to make sure it is available */
- kr = vm_map_wire(kernel_map,
- src_mapping,
- src_mapping + length,
- VM_PROT_READ,
- FALSE);
- if (kr != KERN_SUCCESS) {
- /*
- * Wiring failed, so unmap source and fall back
- * to page by page mapping of the source.
- */
- kr = vm_map_remove(kernel_map,
- src_mapping,
- src_mapping + length,
- VM_MAP_NO_FLAGS);
- assert(kr == KERN_SUCCESS);
- src_mapping = 0;
- src_vaddr = 0;
- src_map_page_by_page = TRUE;
- break;
- }
- /* source region is now fully mapped and wired */
- src_map_page_by_page = FALSE;
- src_vaddr = CAST_DOWN(vm_offset_t, src_mapping);
- break;
- case KERN_NO_SPACE:
- /* we couldn't map the entire source, so map it page by page */
- src_map_page_by_page = TRUE;
- /* release the reference for the failed mapping */
- vm_object_deallocate(src_object);
- break;
- default:
- vm_object_deallocate(src_object);
- retval = kr;
- goto done;
- }
-
+ PAGER_DEBUG(PAGER_PAGEIN, ("apple_protect_pager_data_request: %p, %llx, %x, %x, pager %p\n", mem_obj, offset, length, protection_required, pager));