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

Function vm_map_clip_start

freebsd/vm/vm_map.c:2463–2497  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2461 * it splits the entry into two.
2462 */
2463static int
2464vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t startaddr)
2465{
2466 vm_map_entry_t new_entry;
2467 int bdry_idx;
2468
2469 if (!map->system_map)
2470 WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
2471 "%s: map %p entry %p start 0x%jx", __func__, map, entry,
2472 (uintmax_t)startaddr);
2473
2474 if (startaddr <= entry->start)
2475 return (KERN_SUCCESS);
2476
2477 VM_MAP_ASSERT_LOCKED(map);
2478 KASSERT(entry->end > startaddr && entry->start < startaddr,
2479 ("%s: invalid clip of entry %p", __func__, entry));
2480
2481 bdry_idx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >>
2482 MAP_ENTRY_SPLIT_BOUNDARY_SHIFT;
2483 if (bdry_idx != 0) {
2484 if ((startaddr & (pagesizes[bdry_idx] - 1)) != 0)
2485 return (KERN_INVALID_ARGUMENT);
2486 }
2487
2488 new_entry = vm_map_entry_clone(map, entry);
2489
2490 /*
2491 * Split off the front portion. Insert the new entry BEFORE this one,
2492 * so that this entry has the specified starting address.
2493 */
2494 new_entry->end = startaddr;
2495 vm_map_entry_link(map, new_entry);
2496 return (KERN_SUCCESS);
2497}
2498
2499/*
2500 * vm_map_lookup_clip_start:

Callers 5

vm_map_lookup_clip_startFunction · 0.85
vm_map_submapFunction · 0.85
vm_map_protectFunction · 0.85
vm_map_unwireFunction · 0.85
vm_map_wire_lockedFunction · 0.85

Calls 2

vm_map_entry_cloneFunction · 0.85
vm_map_entry_linkFunction · 0.85

Tested by

no test coverage detected