mmap(D2)

mmap - support virtual mapping for memory-mapped device

As shipped in IRIX 6.5.19. Unchanged since IRIX 6.5.

NAME
     mmap - support virtual mapping for memory-mapped device

SYNOPSIS
     #include <sys/types.h>
     #include <sys/param.h>
     #include <sys/mman.h>
     #include <sys/ddi.h>
     int prefixmmap(dev_t dev, off_t off, int prot);

   Arguments
     dev  Device whose memory is to be mapped.

     off  Offset within device memory at which mapping begins.

     prot Protection flags from mman.h.

DESCRIPTION
     The mmap entry point provides a way to support character drivers for
     memory-mapped devices.  A memory-mapped device has memory that can be
     mapped into a process's address space.  The mmap(2) system call, when
     applied to a character special file, allows this device memory to be
     mapped into user space for direct access by the user application (this
     way no kernel buffering or system call overhead is incurred).

     The mmap routine checks if the offset is within the range of pages
     supported by the device.  For example, a device that has 32K bytes of
     memory that can be mapped into user space should not support offsets
     greater than, or equal to, 32K.  If the offset does not exist, then
     NOPAGE is returned.  If the offset does exist, the mmap routine returns
     the physical page ID for the page at offset off in the device's memory;
     that is, the offset in units of pages.

   Return Values
     If the protection and offset are valid for the device, the driver should
     return the physical page ID.  Otherwise, NOPAGE should be returned.

USAGE
     This entry point is optional, and valid for memory-mapped character
     device or character pseudo-device drivers only.

     Valid values for prot are:

          PROT_READ     Page can be read.

          PROT_WRITE    Page can be written.

          PROT_EXEC     Page can be executed.
          PROT_ALL      All of the above.

   Synchronization Constraints
     The mmap routine has user context and can sleep.

REFERENCES
     map(D2X), unmap(D2X)