MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_map_submap

Function vm_map_submap

freebsd/vm/vm_map.c:2592–2632  ·  view source on GitHub ↗

* vm_map_submap: [ kernel use only ] * * Mark the given range as handled by a subordinate map. * * This range must have been created with vm_map_find, * and no other operations may have been performed on this * range prior to calling vm_map_submap. * * Only a limited number of operations can be performed * within this rage after calling vm_map_submap: * vm_fault * [Don't try vm_map_co

Source from the content-addressed store, hash-verified

2590 * submap (if desired). [Better yet, don't try it.]
2591 */
2592int
2593vm_map_submap(
2594 vm_map_t map,
2595 vm_offset_t start,
2596 vm_offset_t end,
2597 vm_map_t submap)
2598{
2599 vm_map_entry_t entry;
2600 int result;
2601
2602 result = KERN_INVALID_ARGUMENT;
2603
2604 vm_map_lock(submap);
2605 submap->flags |= MAP_IS_SUB_MAP;
2606 vm_map_unlock(submap);
2607
2608 vm_map_lock(map);
2609 VM_MAP_RANGE_CHECK(map, start, end);
2610 if (vm_map_lookup_entry(map, start, &entry) && entry->end >= end &&
2611 (entry->eflags & MAP_ENTRY_COW) == 0 &&
2612 entry->object.vm_object == NULL) {
2613 result = vm_map_clip_start(map, entry, start);
2614 if (result != KERN_SUCCESS)
2615 goto unlock;
2616 result = vm_map_clip_end(map, entry, end);
2617 if (result != KERN_SUCCESS)
2618 goto unlock;
2619 entry->object.sub_map = submap;
2620 entry->eflags |= MAP_ENTRY_IS_SUB_MAP;
2621 result = KERN_SUCCESS;
2622 }
2623unlock:
2624 vm_map_unlock(map);
2625
2626 if (result != KERN_SUCCESS) {
2627 vm_map_lock(submap);
2628 submap->flags &= ~MAP_IS_SUB_MAP;
2629 vm_map_unlock(submap);
2630 }
2631 return (result);
2632}
2633
2634/*
2635 * The maximum number of pages to map if MAP_PREFAULT_PARTIAL is specified

Callers 1

kmem_subinitFunction · 0.85

Calls 3

vm_map_lookup_entryFunction · 0.85
vm_map_clip_startFunction · 0.85
vm_map_clip_endFunction · 0.85

Tested by

no test coverage detected