## Virtual Device Driver Reference for OS/2

[prev][next][parent][TOC]

### VDHMapPages - Parameters

pvdhmsSourceRegion (PVDHMAPSOURCE) Pointer to VDHMAPSOURCE structure.

VDHMAPSOURCE is the source region definition for VDHMapPages with a data structure as follows:

    typedef struct VDHMapSource_s {

        ULONG   vdhms_laddr;     /* Source linear address of source */

                                 /* memory object.  Source address  */

                                 /* to be mapped.  Defines the start*/

                                 /* of the source region for the    */

                                 /* mapping.  The region is the same*/

                                 /* length as the target region.    */

        ULONG   vdhms_hobj;      /* Memory object handle set by the */

                                 /* service to hold a source handle */

                                 /* for VDHMT_LINEAR mappings.      */

                                 /* See the VDHMT_LINEAR            */

                                 /* description under MappingFlag.  */

    } VDHMAPSOURCE;

    typedef VDHMAPSOURCE *PVDHMAPSOURCE;

pvdhmtTargetRegion (PVDHMAPTARGET) Target region definition. Pointer to VDHMAPTARGET structure.

VDHMAPTARGET is the target region definition for VDHMapPages with a data structure as follows:

    typedef struct VDHMapTarget_s {

        ULONG   vdhmt_laddr;     /* Address in V86-space to be      */

                                 /* mapped.                         */

                                 /* (0 <= vdhmt_laddr < 1MB+64KB)   */

        ULONG   vdhmt_cpg;       /* Count of pages to map.          */

        ULONG   vdhmt_hmap;      /* Mapping handle. Must be zero on */

                                 /* the first call to VDHMapPages   */

                                 /* for region.  Set by the service */

                                 /* to hold a handle used for       */

                                 /* remapping the region. The handle*/

                                 /* is reset each time it is used.  */

                                 /* vdhmt_hmap must be the value    */

                                 /* returned from the previous      */

                                 /* VDHMapPages call for the region */

                                 /* unless the pages are either     */

                                 /* already invalid or else are     */

                                 /* being made invalid.  If either  */

                                 /* the old or new mapping is       */

                                 /* invalid pages, vdhmt_hmap can   */

                                 /* be 0.                           */

                                 /* Making a region invalid restores*/

                                 /* pages in the region to their    */

                                 /* reserved state, and sets        */

                                 /* vdhmt_hmap to 0.                */

    } VDHMAPTARGET;

    typedef VDHMAPTARGET *PVDHMAPTARGET;

flMappingFlag (ULONG) Mapping options flag.

Possible values are:

VDHMT_INVALID Make target region pages invalid. vdhmt_hmap can be 0 (zero). This service is faster when the handle is provided, but virtual device drivers that do not store handles can map to invalid before remapping a region. Note that pvdhmsSourceRegion is ignored.

VDHMT_LINEAR Map linear source region into target region. vdhms_laddr contains the linear address to map at the start of the target region. This can only be a page-granular address in a memory allocation that was obtained by using VDHAllocPages or VDHReallocPages. After a successful mapping, the target region aliases the corresponding region of the source.

vdhms_hobj must be 0 (zero) the first time a newly allocated or reallocated source object is mapped. On a successful mapping, vdhms_hobj is filled in. Using this handle on the next mapping that uses the same source object speeds up that mapping call. Any linear address (laddr) at the start of the target region can be mapped using the handle. The returned result must be stored after each mapping call. Virtual device drivers can avoid storing this handle and always use 0 (zero), however, the call will be slower.

VDHMT_PHYSICAL Map physical source region into target region. vdhms_laddr contains the physical address to map at the start of the target region. vdhms_hobj is ignored.

VDHMT_BLACK_HOLE Map target region to black hole pages. pvdhmsSourceRegion is ignored.

rc (BOOL) - returns

Success If the function is successful, it returns a nonzero value.

Failure If the function fails, it returns 0 (zero). VDHGetError should be called to determine the nature of the problem.