Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <sys/ddi.h> #include <sys/sunddi.h> int ddi_umem_lock(caddr_t addr, size_t len, int flags, ddi_umem_cookie_t *cookiep);
void ddi_umem_unlock(ddi_umem_cookie_t cookie);
Virtual address of memory object
Length of memory object in bytes
Valid flags include: DDI_UMEMLOCK_READ
Memory pages are locked to be read from. (Disk write or a network send.)
Memory pages are locked to be written to. (Disk read or a network receive.)
Pointer to a kernel memory cookie.
Kernel memory cookie allocated by ddi_umem_lock().
The virtual address and length specified must be at a page boundary and the mapping performed in terms of the system page size. See pagesize(1).
The flags argument indicates the intended use of the locked memory. Set flags to DDI_UMEMLOCK_READ if the memory pages will be read (for example, in a disk write or a network send.) Set flags to DDI_UMEMLOCK_WRITE if the memory pages will be written (for example, in a disk read or a network receive). You must choose one (and only one) of these values.
To unlock the locked pages, the drivers call ddi_umem_unlock(9F) with the cookie obtained from ddi_umem_lock().
The process is not allowed to exec(2) or fork(2) while its physical pages are locked down by the device driver.
The device driver must ensure that the physical pages have been unlocked after the application has called close(2).
User process has no mapping at that address range or does not support locking
User process does not have the required permission.
The system does not have sufficient resources to lock memory, or locking len memory would exceed a limit or resource control on locked memory.
Could not allocate system resources required to lock the pages. The ddi_umem_lock() could succeed at a later time.
Requested memory is not aligned on a system page boundary.
The ddi_umem_unlock() function can defer unlocking of the pages to a later time depending on the implementation.