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

Function vm_map_clip_end

freebsd/vm/vm_map.c:2537–2572  ·  view source on GitHub ↗

* vm_map_clip_end: [ internal use only ] * * Asserts that the given entry ends at or before * the specified address; if necessary, * it splits the entry into two. */

Source from the content-addressed store, hash-verified

2535 * it splits the entry into two.
2536 */
2537static int
2538vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t endaddr)
2539{
2540 vm_map_entry_t new_entry;
2541 int bdry_idx;
2542
2543 if (!map->system_map)
2544 WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
2545 "%s: map %p entry %p end 0x%jx", __func__, map, entry,
2546 (uintmax_t)endaddr);
2547
2548 if (endaddr >= entry->end)
2549 return (KERN_SUCCESS);
2550
2551 VM_MAP_ASSERT_LOCKED(map);
2552 KASSERT(entry->start < endaddr && entry->end > endaddr,
2553 ("%s: invalid clip of entry %p", __func__, entry));
2554
2555 bdry_idx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >>
2556 MAP_ENTRY_SPLIT_BOUNDARY_SHIFT;
2557 if (bdry_idx != 0) {
2558 if ((endaddr & (pagesizes[bdry_idx] - 1)) != 0)
2559 return (KERN_INVALID_ARGUMENT);
2560 }
2561
2562 new_entry = vm_map_entry_clone(map, entry);
2563
2564 /*
2565 * Split off the back portion. Insert the new entry AFTER this one,
2566 * so that this entry has the specified ending address.
2567 */
2568 new_entry->start = endaddr;
2569 vm_map_entry_link(map, new_entry);
2570
2571 return (KERN_SUCCESS);
2572}
2573
2574/*
2575 * vm_map_submap: [ kernel use only ]

Callers 7

vm_map_submapFunction · 0.85
vm_map_protectFunction · 0.85
vm_map_madviseFunction · 0.85
vm_map_inheritFunction · 0.85
vm_map_unwireFunction · 0.85
vm_map_wire_lockedFunction · 0.85
vm_map_deleteFunction · 0.85

Calls 2

vm_map_entry_cloneFunction · 0.85
vm_map_entry_linkFunction · 0.85

Tested by

no test coverage detected