VP_STATUS VideoPortMapBankedMemory(
PVOID HwDeviceExtension, | |
PHYSICAL_ADDRESS PhysicalAddress, | |
PULONG Length, | |
PULONG InIoSpace, | |
PVOID *VirtualAddress, | |
ULONG BankLength, | |
UCHAR ReadWriteBank, | |
PBANKED_SECTION_ROUTINE BankRoutine, | |
PVOID Context | |
); |
VideoPortMapBankedMemory remaps a bus-relative physical range of video memory into the corresponding display driver’s virtual address space in response to a VRP with the IoControlCode member set to IOCTL_VIDEO_SHARE_VIDEO_MEMORY and possibly to IOCTL_VIDEO_MAP_VIDEO_MEMORY.
VideoPortMapBankedMemory returns NO_ERROR if the given logical range was successfully mapped to a user-space virtual range. Otherwise, it can return ERROR_INVALID_PARAMETER.
VideoPortMapBankedMemory runs in kernel mode within the same context as the user-mode thread that initiated the call.
VideoPortMapBankedMemory is called by miniport drivers to efficiently manage x86 type devices that are limited to mapping a frame buffer in banks. When this routine returns to the caller, the frame buffer managed by the miniport driver is mapped as a linear frame buffer into the address space of the requesting process (see VirtualAddress parameter). When an access is made to an address in that mapped space, the Memory Manager calls the miniport driver to update the Bank Index Register to point to a new bank that contains the currently referenced address. The Bank Index Register is maintained by the miniport driver in BankRoutine. The correct Bank Index is calculated by the Memory Manager transparently to a display driver and passed to the miniport driver in the callback to BankRoutine.
Callers of VideoPortMapBankedMemory are running at IRQL = PASSIVE_LEVEL.
HwVidBankedMemoryCallback, IOCTL_VIDEO_MAP_VIDEO_MEMORY, IOCTL_VIDEO_SHARE_VIDEO_MEMORY, IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY, VIDEO_REQUEST_PACKET, VideoPortMapMemory, VideoPortUnmapMemory