Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought






       drv_mmap(D3)                                            drv_mmap(D3)


       NAME
             drv_mmap - set up user mapping to kernel virtual or physical
             addresses

       SYNOPSIS
             #include <sys/types.h>
             #include <sys/mman.h>
             #include <sys/ddi.h>
             int drv_mmap(vaddr_t vaddr, paddr_t paddr, size_t len, vaddr_t *uvaddrp,
                uint_t prot, uint_t maxprot, uint_t flags)

          Arguments
             vaddr     Kernel address of the object to be mapped (if
                       present, paddr is ignored).

             paddr     Physical address of the object to be mapped.

             len       Number of bytes to map into user space.

             *uvaddrp  User address at which to map the object.

             prot      Initial protection flags (from mman.h).

             maxprot   Maximum protection.

             flags     Specifies whether the user address is supplied by
                       the driver or the kernel.

       DESCRIPTION
             drv_mmap provides a convenient interface for setting up a user
             mapping to a range of kernel virtual or physical addresses.

          Return Values
             If the parameters are valid, drv_mmap returns with the user
             address for the object map in *uvaddrp, and returns 0.
             Otherwise, a non-zero errno is returned.

       USAGE
             A typical use for drv_mmap is for video frame buffers mapped
             through ioctls [instead of mmap(D2)] for compatibility with
             pre-SVR4 applications.

             If the MAP_FIXED flag is used, *uvaddrp will be used as the
             user address at which to map the object and any previous
             mapping at this address will be replaced; otherwise, the
             kernel will choose a currently unused user address and place


                           Copyright 1994 Novell, Inc.               Page 1













      drv_mmap(D3)                                            drv_mmap(D3)


            it into *uvaddrp.

            If vaddr is non-zero, it is the kernel address of the object
            to be mapped (and paddr is ignored); otherwise, paddr is the
            physical address of the object.

            Note that the mapping is at a page granularity.  You can pass
            in addresses and lengths which are not page-aligned, but the
            user will have access to entire pages.

            The parameter prot determines whether read, write, execute, or
            some combination of these accesses are permitted to the pages
            being mapped.  The protection options are defined in
            <sys/mman.h> as: Page can be read.  Page can be written.  Page
            can be executed.  Page cannot be accessed.

            Not all implementations literally provide all possible
            combinations.  For example, PROT_WRITE is often implemented as
            PROT_READ|PROT_WRITE and PROT_EXEC as PROT_READ|PROT_EXEC.
            However, no implementation will permit a write to succeed if
            PROT_WRITE has not been set.

            The parameter maxprot is similar to prot, but specifies the
            maximum permissions the user can subsequently assign through
            mprotect(2).

            To release a mapping acquired by drv_mmap, use drv_munmap(D3).

         Level
            Base only.

         Synchronization Constraints
            Can sleep.

            Basic locks may not be held, but sleep locks may be held.

      REFERENCES
            drv_munmap(D3)

      NOTICES
         Portability
            All processors

         Applicability
            ddi: 5, 5mp, 6, 6mp, 7, 7mp



                          Copyright 1994 Novell, Inc.               Page 2








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026