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

Function vm_map_wire_locked

freebsd/vm/vm_map.c:3463–3695  ·  view source on GitHub ↗

* vm_map_wire_locked: * * Implements both kernel and user wiring. Returns with the map locked, * the map lock may be dropped. */

Source from the content-addressed store, hash-verified

3461 * the map lock may be dropped.
3462 */
3463int
3464vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags)
3465{
3466 vm_map_entry_t entry, first_entry, next_entry, prev_entry;
3467 vm_offset_t faddr, saved_end, saved_start;
3468 u_long incr, npages;
3469 u_int bidx, last_timestamp;
3470 int rv;
3471 bool holes_ok, need_wakeup, user_wire;
3472 vm_prot_t prot;
3473
3474 VM_MAP_ASSERT_LOCKED(map);
3475
3476 if (start == end)
3477 return (KERN_SUCCESS);
3478 prot = 0;
3479 if (flags & VM_MAP_WIRE_WRITE)
3480 prot |= VM_PROT_WRITE;
3481 holes_ok = (flags & VM_MAP_WIRE_HOLESOK) != 0;
3482 user_wire = (flags & VM_MAP_WIRE_USER) != 0;
3483 VM_MAP_RANGE_CHECK(map, start, end);
3484 if (!vm_map_lookup_entry(map, start, &first_entry)) {
3485 if (holes_ok)
3486 first_entry = vm_map_entry_succ(first_entry);
3487 else
3488 return (KERN_INVALID_ADDRESS);
3489 }
3490 for (entry = first_entry; entry->start < end; entry = next_entry) {
3491 if (entry->eflags & MAP_ENTRY_IN_TRANSITION) {
3492 /*
3493 * We have not yet clipped the entry.
3494 */
3495 next_entry = vm_map_entry_in_transition(map, start,
3496 &end, holes_ok, entry);
3497 if (next_entry == NULL) {
3498 if (entry == first_entry)
3499 return (KERN_INVALID_ADDRESS);
3500 rv = KERN_INVALID_ADDRESS;
3501 goto done;
3502 }
3503 first_entry = (entry == first_entry) ?
3504 next_entry : NULL;
3505 continue;
3506 }
3507 rv = vm_map_clip_start(map, entry, start);
3508 if (rv != KERN_SUCCESS)
3509 goto done;
3510 rv = vm_map_clip_end(map, entry, end);
3511 if (rv != KERN_SUCCESS)
3512 goto done;
3513
3514 /*
3515 * Mark the entry in case the map lock is released. (See
3516 * above.)
3517 */
3518 KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) == 0 &&
3519 entry->wiring_thread == NULL,
3520 ("owned map entry %p", entry));

Callers 4

vm_mmap_objectFunction · 0.85
vm_map_wireFunction · 0.85
vm_map_growstackFunction · 0.85
kern_breakFunction · 0.85

Calls 15

vm_map_lookup_entryFunction · 0.85
vm_map_entry_succFunction · 0.85
vm_map_clip_startFunction · 0.85
vm_map_clip_endFunction · 0.85
vm_map_busyFunction · 0.85
vm_faultFunction · 0.85
vm_map_unbusyFunction · 0.85
vm_map_entry_predFunction · 0.85

Tested by

no test coverage detected