userdma(D3X)userdma(D3X)NAME
userdma,undma - lock, unlock physical memory in user space
SYNOPSIS
#include "sys/types.h"
#include "sys/buf.h"
userdma(void *usr_v_addr, size_t num_bytes, int rw void *MBZ);
undma(void *usr_v_addr, size_t num_bytes, int rw);
Arguments
usr_v_addr
User process address space.
num_bytes
Number of bytes.
rw If set to B_READ, then the memory space will be readable upon return
from this call. If set to B_WRITE, the memory will be writable upon
return.
MBZ must be set to 0.
DESCRIPTION
userdma prepares memory before a DMA operation into or from a user
process' address space. It locks the physical pages associated with
num_bytes bytes of user virtual memory starting at location usr_v_addr.
If the rw flag is set to B_READ, then the memory space will be readable
upon return from this call. If, however, the flag is set to B_WRITE, the
memory will be writable upon return. userdma also invalidates the data
cache lines corresponding to the given address and count, if necessary.
When the operation is complete, call undma to unlock these pages.
RETURN VALUES
If userdma is successful, it returns 0; otherwise, it returns an error
number as follows:
EFAULT
The user buffer was outside the allocated address space.
EAGAIN
Total amount of system memory to lock user pages is temporarily
insufficient.
EBUSY
There is not enough kernel memory available to map the user pages to
kernel virtual memory.
Page 1