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

Function vm_map_delete

freebsd/vm/vm_map.c:3931–4016  ·  view source on GitHub ↗

* vm_map_delete: [ internal use only ] * * Deallocates the given address range from the target * map. */

Source from the content-addressed store, hash-verified

3929 * map.
3930 */
3931int
3932vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end)
3933{
3934 vm_map_entry_t entry, next_entry, scratch_entry;
3935 int rv;
3936
3937 VM_MAP_ASSERT_LOCKED(map);
3938
3939 if (start == end)
3940 return (KERN_SUCCESS);
3941
3942 /*
3943 * Find the start of the region, and clip it.
3944 * Step through all entries in this region.
3945 */
3946 rv = vm_map_lookup_clip_start(map, start, &entry, &scratch_entry);
3947 if (rv != KERN_SUCCESS)
3948 return (rv);
3949 for (; entry->start < end; entry = next_entry) {
3950 /*
3951 * Wait for wiring or unwiring of an entry to complete.
3952 * Also wait for any system wirings to disappear on
3953 * user maps.
3954 */
3955 if ((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0 ||
3956 (vm_map_pmap(map) != kernel_pmap &&
3957 vm_map_entry_system_wired_count(entry) != 0)) {
3958 unsigned int last_timestamp;
3959 vm_offset_t saved_start;
3960
3961 saved_start = entry->start;
3962 entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP;
3963 last_timestamp = map->timestamp;
3964 (void) vm_map_unlock_and_wait(map, 0);
3965 vm_map_lock(map);
3966 if (last_timestamp + 1 != map->timestamp) {
3967 /*
3968 * Look again for the entry because the map was
3969 * modified while it was unlocked.
3970 * Specifically, the entry may have been
3971 * clipped, merged, or deleted.
3972 */
3973 rv = vm_map_lookup_clip_start(map, saved_start,
3974 &next_entry, &scratch_entry);
3975 if (rv != KERN_SUCCESS)
3976 break;
3977 } else
3978 next_entry = entry;
3979 continue;
3980 }
3981
3982 /* XXXKIB or delete to the upper superpage boundary ? */
3983 rv = vm_map_clip_end(map, entry, end);
3984 if (rv != KERN_SUCCESS)
3985 break;
3986 next_entry = vm_map_entry_succ(entry);
3987
3988 /*

Callers 9

shm_mmap_largeFunction · 0.85
kern_munmapFunction · 0.85
kmapent_allocFunction · 0.85
vm_map_fixedFunction · 0.85
vm_map_findFunction · 0.85
vm_map_removeFunction · 0.85
vm_map_stack_lockedFunction · 0.85
kern_breakFunction · 0.85
kmap_free_wakeupFunction · 0.85

Calls 8

vm_map_lookup_clip_startFunction · 0.85
vm_map_pmapFunction · 0.85
vm_map_clip_endFunction · 0.85
vm_map_entry_succFunction · 0.85
vm_map_entry_unwireFunction · 0.85
vm_map_entry_deleteFunction · 0.85
pmap_removeFunction · 0.50

Tested by

no test coverage detected