Copyright (c) 2003 Bruce M Simpson <email@example.com> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documenta...
NAMEvm_map_wire vm_map_unwire - manage page wiring within a virtual memory map
SYNOPSISIn sys/param.h In vm/vm.h In vm/vm_map.h Ft int Fn vm_map_wire vm_map_t map vm_offset_t start vm_offset_t end int flags Ft int Fo vm_map_unwire Fa vm_map_t map vm_offset_t start vm_offset_t end int flags Fc
DESCRIPTIONThe Fn vm_map_wire function is responsible for wiring pages in the range between Fa start and Fa end within the map Fa map . Wired pages are locked into physical memory, and may not be paged out as long as their wire count remains above zero.
The Fn vm_map_unwire function performs the corresponding unwire operation.
The Fa flags argument is a bit mask, consisting of the following flags:
If the VM_MAP_WIRE_USER flag is set, the function operates within user address space.
If the VM_MAP_WIRE_HOLESOK flag is set, it may operate upon an arbitrary range within the address space of Fa map .
If a contiguous range is desired, callers should explicitly express their intent by specifying the VM_MAP_WIRE_NOHOLES flag.
IMPLEMENTATION NOTESBoth functions will attempt to acquire a lock on the map using vm_map_lock9 and hold it for the duration of the call. If they detect MAP_ENTRY_IN_TRANSITION they will call vm_map_unlock_and_wait9 until the map becomes available again.
The map could have changed during this window as it was held by another consumer, therefore consumers of this interface should check for this condition using the return values below.
RETURN VALUESThe Fn vm_map_wire and Fn vm_map_unwire functions have identical return values. The functions return KERN_SUCCESS if all pages within the range were [un]wired successfully.
Otherwise, if the specified range was not valid, or if the map changed while the MAP_ENTRY_IN_TRANSITION flag was set, KERN_INVALID_ADDRESS is returned.