DXGKCB_MAP_MEMORY callback function (dispmprt.h)

The DxgkCbMapMemory function maps a range of translated physical addresses (associated with a memory resource assigned to a display adapter) into system space or the virtual address space of a user-mode process.

Syntax

DXGKCB_MAP_MEMORY DxgkcbMapMemory;

NTSTATUS DxgkcbMapMemory(
  [in]  HANDLE DeviceHandle,
  [in]  PHYSICAL_ADDRESS TranslatedAddress,
  [in]  ULONG Length,
  [in]  BOOLEAN InIoSpace,
  [in]  BOOLEAN MapToUserMode,
  [in]  MEMORY_CACHING_TYPE CacheType,
  [out] PVOID *VirtualAddress
)
{...}

Parameters

[in] DeviceHandle

A handle that represents a display adapter. The display miniport driver previously obtained this handle in the DeviceHandle member of the DXGKRNL_INTERFACE structure that was passed to DxgkDdiStartDevice.

[in] TranslatedAddress

The base translated physical address of the memory range to be mapped. The display miniport driver previously obtained this address by calling DxgkCbGetDeviceInformation.

[in] Length

The size, in bytes, of the range to be mapped.

[in] InIoSpace

A Boolean value that specifies whether the range is in I/O space (TRUE) or memory space (FALSE).

[in] MapToUserMode

A Boolean value that specifies whether the range is mapped into user-mode space or system space. If TRUE, the range is mapped into the (user-mode) virtual address space of the current process. If FALSE, the range is mapped into system space. If InIoSpace is TRUE, this parameter is ignored.

[in] CacheType

A MEMORY_CACHING_TYPE enumerator that specifies the caching behavior of the mapped range.

[out] VirtualAddress

A pointer to a variable that receives the address of the beginning of the mapped range. The way that the mapped range is accessed depends on the values of InIoSpace and MapToUserMode. The following table summarizes the different ways that the mapped range is accessed.

Value of InIoSpace MapToUserMode is FALSE MapToUserMode is TRUE
FALSE READ_REGISTER_X WRITE_REGISTER_X User-mode code performs ordinary memory access.
TRUE READ_PORT_X WRITE_PORT_X Not possible.

Return value

DxgkCbMapMemory returns STATUS_SUCCESS if it succeeds. Otherwise, it returns one of the error codes defined in Ntstatus.h.

Remarks

The PHYSICAL_ADDRESS data type is defined in Ntdef.h.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Desktop
Header dispmprt.h (include Dispmprt.h)
IRQL PASSIVE_LEVEL

See also

MEMORY_CACHING_TYPE