Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

vm_map_pageable(9r) [osf1 man page]

vm_map_pageable(9r)													       vm_map_pageable(9r)

NAME
vm_map_pageable - General: Sets pageability of the specified address range SYNOPSIS
kern_return_t vm_map_pageable( vm_map_t map, vm_offset_t start, vm_offset_t end, vm_prot_t access_type ); ARGUMENTS
Specifies the address map associated with an individual process. Specifies the starting address of an address range. Typically, this is the address of the user's buffer where the DMA operation occurs. Specifies the ending address of a consecutive range of addresses begin- ning with the start argument. Specifies the access mode to be set for memory specified by the start and end arguments. You can set this argument to VM_PROT_NONE or to the bitwise inclusive OR of the protection bits VM_PROT_READ and VM_PROT_WRITE. These bits are defined in the file <mach/vm_prot.h> and have the following meanings: Modifies the memory attributes so that the specified range of addresses is no longer locked. This should be done after the DMA operation has completed. Verifies that the specifed range of addresses is readable by the specified process. If so, the range of addresses is locked in memory to remain stable throughout the DMA operation. Verifies that the specifed range of addresses is writable by the specified process. If so, the range of addresses is locked in memory to remain stable throughout the DMA operation. Verifies that the specifed range of addresses is readable and writable by the specified process. If so, the range of addresses is locked in memory to remain stable throughout the DMA operation. DESCRIPTION
The vm_map_pageable routine ensures that the address range you specified in the start and end arguments is accessible. If the address range is accessible by the specified process, the memory associated with this address range will have its locked attributes modified as specified by the access_type argument. A kernel module can call this routine prior to performing a DMA operation to ensure that: The currently run- ning process has read or write access permission to the user's buffer The memory representing the user's buffer is locked so that it remains available throughout the DMA operation. NOTES
This routine may block in the kernel. Therefore, you should release all locks and lower the SPL before calling vm_map_pageable. When the routine returns, you should relock the data and check the data integrity. RETURN VALUES
Upon successful completion, the vm_map_pageable routine returns the value 0 (zero). Otherwise, it returns a nonzero value to indicate an error. EXAMPLE
The following code fragment shows how the vm_map_pageable routine ensures that the user's buffer is accessible to cause the corresponding memory to be locked: if (vm_map_pageable(current_task()->map, trunc_page(bp->b_un.b_addr), round_page(bp->b_un.b_addr + (int)bp->b_bcount), (bp->b_flags == B_READ ? VM_PROT_READ : VM_PROT_WRITE))) { /*************************************************** * Here you implement the code to perform the * * actual DMA operation. Upon conclusion of the * * DMA operation, add the following code to * * release the locked attribute. * ***************************************************/ if (vm_map_pageable(current_task()->map, trunc_page(bp->b_un.b_addr), round_page(bp->b_un.b_addr + (int)bp->b_bcount), VM_PROT_NONE)) { SEE ALSO
Routines: current_task(9r), round_page(9r), trunc_page(9r) vm_map_pageable(9r)

Check Out this Related Man Page

VM_MAP_WIRE(9)						   BSD Kernel Developer's Manual					    VM_MAP_WIRE(9)

NAME
vm_map_wire, vm_map_unwire -- manage page wiring within a virtual memory map SYNOPSIS
#include <sys/param.h> #include <vm/vm.h> #include <vm/vm_map.h> int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags); int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags); DESCRIPTION
The vm_map_wire() function is responsible for wiring pages in the range between start and end within the map map. Wired pages are locked into physical memory, and may not be paged out as long as their wire count remains above zero. The vm_map_unwire() function performs the corresponding unwire operation. The 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 map. If a contiguous range is desired, callers should explicitly express their intent by specifying the VM_MAP_WIRE_NOHOLES flag. IMPLEMENTATION NOTES
Both functions will attempt to acquire a lock on the map using vm_map_lock(9) and hold it for the duration of the call. If they detect MAP_ENTRY_IN_TRANSITION, they will call vm_map_unlock_and_wait(9) 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 VALUES
The vm_map_wire() and 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. SEE ALSO
mlockall(2), munlockall(2), vm_map(9) AUTHORS
This manual page was written by Bruce M Simpson <bms@spc.org>. BSD
July 19, 2003 BSD
Man Page