[Spice-devel] [PATCH qxl-wddm-dod v6 2/4] Using declspec instead of #pragma to declare pageable functions

Sameeh Jubran sameeh at daynix.com
Wed Sep 28 11:09:26 UTC 2016


This patch replaces the "#pragma code_seg(push)" and "#pragma code_seg(pop)"
with __declspec(code_seg("PAGE")) for declaring code as pageable. This
change enahnces maintainability as it is much clearer which functions are paged.

Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
---
 qxldod/QxlDod.cpp | 140 +++++++++++++++++++++++++++++++++++++++++++-------
 qxldod/QxlDod.h   | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 267 insertions(+), 24 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index ef21176..2bc6b77 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -2,8 +2,6 @@
 #include "qxldod.h"
 #include "qxl_windows.h"
 
-#pragma code_seg(push)
-#pragma code_seg()
 
 #define WIN_QXL_INT_MASK ((QXL_INTERRUPT_DISPLAY) | \
                           (QXL_INTERRUPT_CURSOR) | \
@@ -47,7 +45,6 @@ BYTE PixelMask[BITS_PER_BYTE]  = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
                                        ((ULONG)LOWER_5_BITS((Pixel)) << SHIFT_LOWER_5_IN_565_BACK))
 
 
-#pragma code_seg(pop)
 
 struct QXLEscape {
     uint32_t ioctl;
@@ -57,6 +54,7 @@ struct QXLEscape {
     };
 };
 
+QXL_PAGED
 QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) : m_pPhysicalDevice(pPhysicalDeviceObject),
                                                             m_MonitorPowerState(PowerDeviceD0),
                                                             m_AdapterPowerState(PowerDeviceD0)
@@ -73,7 +71,7 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) : m_pPhysicalDevice(pP
     DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));
 }
 
-
+QXL_PAGED
 QxlDod::~QxlDod(void)
 {
     PAGED_CODE();
@@ -82,6 +80,7 @@ QxlDod::~QxlDod(void)
     m_pHWDevice = NULL;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::CheckHardware()
 {
     PAGED_CODE();
@@ -119,6 +118,7 @@ NTSTATUS QxlDod::CheckHardware()
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
                          _In_  DXGKRNL_INTERFACE* pDxgkInterface,
                          _Out_ ULONG*             pNumberOfViews,
@@ -209,6 +209,7 @@ NTSTATUS QxlDod::StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::StopDevice(VOID)
 {
     PAGED_CODE();
@@ -216,6 +217,7 @@ NTSTATUS QxlDod::StopDevice(VOID)
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 VOID QxlDod::CleanUp(VOID)
 {
     PAGED_CODE();
@@ -228,7 +230,7 @@ VOID QxlDod::CleanUp(VOID)
     }
 }
 
-
+QXL_PAGED
 NTSTATUS QxlDod::DispatchIoRequest(_In_  ULONG VidPnSourceId,
                                    _In_  VIDEO_REQUEST_PACKET* pVideoRequestPacket)
 {
@@ -240,6 +242,7 @@ NTSTATUS QxlDod::DispatchIoRequest(_In_  ULONG VidPnSourceId,
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 PCHAR
 DbgDevicePowerString(
     __in DEVICE_POWER_STATE Type
@@ -265,6 +268,7 @@ DbgDevicePowerString(
     }
 }
 
+QXL_PAGED
 PCHAR
 DbgPowerActionString(
     __in POWER_ACTION Type
@@ -294,6 +298,7 @@ DbgPowerActionString(
     }
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::SetPowerState(_In_  ULONG HardwareUid,
                                _In_  DEVICE_POWER_STATE DevicePowerState,
                                _In_  POWER_ACTION       ActionType)
@@ -327,6 +332,7 @@ NTSTATUS QxlDod::SetPowerState(_In_  ULONG HardwareUid,
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::QueryChildRelations(_Out_writes_bytes_(ChildRelationsSize) DXGK_CHILD_DESCRIPTOR* pChildRelations,
                                      _In_  ULONG  ChildRelationsSize)
 {
@@ -356,6 +362,7 @@ NTSTATUS QxlDod::QueryChildRelations(_Out_writes_bytes_(ChildRelationsSize) DXGK
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::QueryChildStatus(_Inout_ DXGK_CHILD_STATUS* pChildStatus,
                                                 _In_    BOOLEAN            NonDestructiveOnly)
 {
@@ -391,6 +398,7 @@ NTSTATUS QxlDod::QueryChildStatus(_Inout_ DXGK_CHILD_STATUS* pChildStatus,
 }
 
 // EDID retrieval
+QXL_PAGED
 NTSTATUS QxlDod::QueryDeviceDescriptor(_In_    ULONG                   ChildUid,
                                        _Inout_ DXGK_DEVICE_DESCRIPTOR* pDeviceDescriptor)
 {
@@ -403,6 +411,7 @@ NTSTATUS QxlDod::QueryDeviceDescriptor(_In_    ULONG                   ChildUid,
     return STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::QueryAdapterInfo(_In_ CONST DXGKARG_QUERYADAPTERINFO* pQueryAdapterInfo)
 {
     PAGED_CODE();
@@ -447,6 +456,7 @@ NTSTATUS QxlDod::QueryAdapterInfo(_In_ CONST DXGKARG_QUERYADAPTERINFO* pQueryAda
     }
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition)
 {
     PAGED_CODE();
@@ -465,6 +475,7 @@ NTSTATUS QxlDod::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetP
 
 // Basic Sample Display Driver does not support hardware cursors, and reports such
 // in QueryAdapterInfo. Therefore this function should never be called.
+QXL_PAGED
 NTSTATUS QxlDod::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape)
 {
     PAGED_CODE();
@@ -475,6 +486,7 @@ NTSTATUS QxlDod::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointer
     return m_pHWDevice->SetPointerShape(pSetPointerShape);
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::Escape(_In_ CONST DXGKARG_ESCAPE* pEscape)
 {
     PAGED_CODE();
@@ -488,7 +500,7 @@ NTSTATUS QxlDod::Escape(_In_ CONST DXGKARG_ESCAPE* pEscape)
     return Status;
 }
 
-
+QXL_PAGED
 NTSTATUS QxlDod::PresentDisplayOnly(_In_ CONST DXGKARG_PRESENT_DISPLAYONLY* pPresentDisplayOnly)
 {
     PAGED_CODE();
@@ -550,6 +562,7 @@ NTSTATUS QxlDod::PresentDisplayOnly(_In_ CONST DXGKARG_PRESENT_DISPLAYONLY* pPre
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::QueryInterface(_In_ CONST PQUERY_INTERFACE pQueryInterface)
 {
     PAGED_CODE();
@@ -560,6 +573,7 @@ NTSTATUS QxlDod::QueryInterface(_In_ CONST PQUERY_INTERFACE pQueryInterface)
     return STATUS_NOT_SUPPORTED;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::StopDeviceAndReleasePostDisplayOwnership(_In_  D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
                                                           _Out_ DXGK_DISPLAY_INFORMATION*      pDisplayInfo)
 {
@@ -584,7 +598,7 @@ NTSTATUS QxlDod::StopDeviceAndReleasePostDisplayOwnership(_In_  D3DDDI_VIDEO_PRE
     return StopDevice();
 }
 
-
+QXL_PAGED
 NTSTATUS QxlDod::QueryVidPnHWCapability(_Inout_ DXGKARG_QUERYVIDPNHWCAPABILITY* pVidPnHWCaps)
 {
     PAGED_CODE();
@@ -608,6 +622,7 @@ NTSTATUS QxlDod::QueryVidPnHWCapability(_Inout_ DXGKARG_QUERYVIDPNHWCAPABILITY*
 
 
 // TODO: Need to also check pinned modes and the path parameters, not just topology
+QXL_PAGED
 NTSTATUS QxlDod::IsSupportedVidPn(_Inout_ DXGKARG_ISSUPPORTEDVIDPN* pIsSupportedVidPn)
 {
     PAGED_CODE();
@@ -670,6 +685,7 @@ NTSTATUS QxlDod::IsSupportedVidPn(_Inout_ DXGKARG_ISSUPPORTEDVIDPN* pIsSupported
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::RecommendFunctionalVidPn(_In_ CONST DXGKARG_RECOMMENDFUNCTIONALVIDPN* CONST pRecommendFunctionalVidPn)
 {
     PAGED_CODE();
@@ -680,6 +696,7 @@ NTSTATUS QxlDod::RecommendFunctionalVidPn(_In_ CONST DXGKARG_RECOMMENDFUNCTIONAL
     return STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::RecommendVidPnTopology(_In_ CONST DXGKARG_RECOMMENDVIDPNTOPOLOGY* CONST pRecommendVidPnTopology)
 {
     PAGED_CODE();
@@ -690,6 +707,7 @@ NTSTATUS QxlDod::RecommendVidPnTopology(_In_ CONST DXGKARG_RECOMMENDVIDPNTOPOLOG
     return STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::RecommendMonitorModes(_In_ CONST DXGKARG_RECOMMENDMONITORMODES* CONST pRecommendMonitorModes)
 {
     PAGED_CODE();
@@ -698,7 +716,7 @@ NTSTATUS QxlDod::RecommendMonitorModes(_In_ CONST DXGKARG_RECOMMENDMONITORMODES*
     return AddSingleMonitorMode(pRecommendMonitorModes);
 }
 
-
+QXL_PAGED
 NTSTATUS QxlDod::AddSingleSourceMode(_In_ CONST DXGK_VIDPNSOURCEMODESET_INTERFACE* pVidPnSourceModeSetInterface,
                                                    D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet,
                                                    D3DDDI_VIDEO_PRESENT_SOURCE_ID SourceId)
@@ -755,6 +773,7 @@ NTSTATUS QxlDod::AddSingleSourceMode(_In_ CONST DXGK_VIDPNSOURCEMODESET_INTERFAC
 }
 
 // Add the current mode information (acquired from the POST frame buffer) as the target mode.
+QXL_PAGED
 NTSTATUS QxlDod::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface,
                                                    D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet,
                                                    _In_opt_ CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnPinnedSourceModeInfo,
@@ -807,7 +826,7 @@ NTSTATUS QxlDod::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMODESET_INTERFAC
     return STATUS_SUCCESS;
 }
 
-
+QXL_PAGED
 NTSTATUS QxlDod::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES* CONST pRecommendMonitorModes)
 {
     PAGED_CODE();
@@ -927,6 +946,7 @@ NTSTATUS QxlDod::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES*
 }
 
 // Tell DMM about all the modes, etc. that are supported
+QXL_PAGED
 NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModality)
 {
     PAGED_CODE();
@@ -1285,6 +1305,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::SetVidPnSourceVisibility(_In_ CONST DXGKARG_SETVIDPNSOURCEVISIBILITY* pSetVidPnSourceVisibility)
 {
     PAGED_CODE();
@@ -1317,6 +1338,7 @@ NTSTATUS QxlDod::SetVidPnSourceVisibility(_In_ CONST DXGKARG_SETVIDPNSOURCEVISIB
 
 // NOTE: The value of pCommitVidPn->MonitorConnectivityChecks is ignored, since BDD is unable to recognize whether a monitor is connected or not
 // The value of pCommitVidPn->hPrimaryAllocation is also ignored, since BDD is a display only driver and does not deal with allocations
+QXL_PAGED
 NTSTATUS QxlDod::CommitVidPn(_In_ CONST DXGKARG_COMMITVIDPN* CONST pCommitVidPn)
 {
     PAGED_CODE();
@@ -1502,6 +1524,7 @@ CommitVidPnExit:
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode,
                                                     CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath)
 {
@@ -1548,6 +1571,7 @@ NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const
 {
     PAGED_CODE();
@@ -1596,6 +1620,7 @@ NTSTATUS QxlDod::IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath)
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const
 {
     PAGED_CODE();
@@ -1627,6 +1652,7 @@ NTSTATUS QxlDod::IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* p
     return STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::UpdateActiveVidPnPresentPath(_In_ CONST DXGKARG_UPDATEACTIVEVIDPNPRESENTPATH* CONST pUpdateActiveVidPnPresentPath)
 {
     PAGED_CODE();
@@ -1652,8 +1678,6 @@ NTSTATUS QxlDod::UpdateActiveVidPnPresentPath(_In_ CONST DXGKARG_UPDATEACTIVEVID
 //
 // Non-Paged Code
 //
-#pragma code_seg(push)
-#pragma code_seg()
 
 VOID QxlDod::DpcRoutine(VOID)
 {
@@ -1781,8 +1805,8 @@ VOID QxlDod::SystemDisplayWrite(_In_reads_bytes_(SourceHeight * SourceStride) VO
 
 }
 
-#pragma code_seg(pop) // End Non-Paged Code
 
+QXL_PAGED
 NTSTATUS QxlDod::WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR pszwValueName, _In_ PCSTR pszValue)
 {
     PAGED_CODE();
@@ -1826,6 +1850,7 @@ NTSTATUS QxlDod::WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR psz
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::RegisterHWInfo(ULONG Id)
 {
     PAGED_CODE();
@@ -1905,6 +1930,7 @@ NTSTATUS QxlDod::RegisterHWInfo(ULONG Id)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDod::ReadConfiguration()
 {
     PAGED_CODE();
@@ -1959,8 +1985,6 @@ NTSTATUS QxlDod::ReadConfiguration()
 //
 // Non-Paged Code
 //
-#pragma code_seg(push)
-#pragma code_seg()
 D3DDDI_VIDEO_PRESENT_SOURCE_ID QxlDod::FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero)
 {
     UNREFERENCED_PARAMETER(TargetId);
@@ -1975,12 +1999,10 @@ D3DDDI_VIDEO_PRESENT_SOURCE_ID QxlDod::FindSourceForTarget(D3DDDI_VIDEO_PRESENT_
     return DefaultToZero ? 0 : D3DDDI_ID_UNINITIALIZED;
 }
 
-#pragma code_seg(pop) // End Non-Paged Code
-
 //
 // Frame buffer map/unmap
 //
-
+QXL_PAGED
 NTSTATUS
 MapFrameBuffer(
     _In_                       PHYSICAL_ADDRESS    PhysicalAddress,
@@ -2022,6 +2044,7 @@ MapFrameBuffer(
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS
 UnmapFrameBuffer(
     _In_reads_bytes_(Length) VOID* VirtualAddress,
@@ -2324,6 +2347,7 @@ VOID BltBits (
     }
 }
 
+QXL_PAGED
 VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
 {
     PAGED_CODE();
@@ -2335,6 +2359,7 @@ VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
     m_Id = 0;
 }
 
+QXL_PAGED
 VgaDevice::~VgaDevice(void)
 {
     PAGED_CODE();
@@ -2348,6 +2373,7 @@ VgaDevice::~VgaDevice(void)
     m_Id = 0;
 }
 
+QXL_PAGED
 BOOL VgaDevice::SetVideoModeInfo(UINT Idx, PVBE_MODEINFO pModeInfo)
 {
     PVIDEO_MODE_INFORMATION pMode = NULL;
@@ -2385,6 +2411,7 @@ BOOL VgaDevice::SetVideoModeInfo(UINT Idx, PVBE_MODEINFO pModeInfo)
     return TRUE;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -2576,6 +2603,7 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::QueryCurrentMode(PVIDEO_MODE RequestedMode)
 {
     PAGED_CODE();
@@ -2586,6 +2614,7 @@ NTSTATUS VgaDevice::QueryCurrentMode(PVIDEO_MODE RequestedMode)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::SetCurrentMode(ULONG Mode)
 {
     PAGED_CODE();
@@ -2604,6 +2633,7 @@ NTSTATUS VgaDevice::SetCurrentMode(ULONG Mode)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::GetCurrentMode(ULONG* pMode)
 {
     PAGED_CODE();
@@ -2622,6 +2652,7 @@ NTSTATUS VgaDevice::GetCurrentMode(ULONG* pMode)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -2633,6 +2664,7 @@ NTSTATUS VgaDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
     return GetModeList(pDispInfo);
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::HWClose(void)
 {
     PAGED_CODE();
@@ -2642,6 +2674,7 @@ NTSTATUS VgaDevice::HWClose(void)
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::SetPowerState(_In_  DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -2668,7 +2701,7 @@ NTSTATUS VgaDevice::SetPowerState(_In_  DEVICE_POWER_STATE DevicePowerState, DXG
     return STATUS_SUCCESS;
 }
 
-
+QXL_PAGED
 NTSTATUS
 VgaDevice::ExecutePresentDisplayOnly(
     _In_ BYTE*             DstAddr,
@@ -2870,6 +2903,7 @@ VgaDevice::ExecutePresentDisplayOnly(
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 VOID VgaDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
 {
     PAGED_CODE();
@@ -2953,6 +2987,7 @@ NTSTATUS VgaDevice::ReleaseFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode)
     return status;
 }
 
+QXL_PAGED
 NTSTATUS  VgaDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape)
 {
     PAGED_CODE();
@@ -2960,6 +2995,7 @@ NTSTATUS  VgaDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
     return STATUS_NOT_SUPPORTED;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition)
 {
     PAGED_CODE();
@@ -2967,6 +3003,7 @@ NTSTATUS VgaDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pS
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS VgaDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
 {
     PAGED_CODE();
@@ -2975,6 +3012,7 @@ NTSTATUS VgaDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
     return STATUS_NOT_IMPLEMENTED;
 }
 
+QXL_PAGED
 QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod)
 {
     PAGED_CODE();
@@ -2988,6 +3026,7 @@ QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod)
     m_Pending = 0;
 }
 
+QXL_PAGED
 QxlDevice::~QxlDevice(void)
 {
     PAGED_CODE();
@@ -3000,6 +3039,7 @@ QxlDevice::~QxlDevice(void)
     m_ModeCount = 0;
 }
 
+QXL_PAGED
 BOOL QxlDevice::SetVideoModeInfo(UINT Idx, QXLMode* pModeInfo)
 {
     PVIDEO_MODE_INFORMATION pMode = NULL;
@@ -3033,6 +3073,7 @@ BOOL QxlDevice::SetVideoModeInfo(UINT Idx, QXLMode* pModeInfo)
     return TRUE;
 }
 
+QXL_PAGED
 void QxlDevice::UpdateVideoModeInfo(UINT Idx, UINT xres, UINT yres, UINT bpp)
 {
     PVIDEO_MODE_INFORMATION pMode = NULL;
@@ -3055,6 +3096,7 @@ void QxlDevice::UpdateVideoModeInfo(UINT Idx, UINT xres, UINT yres, UINT bpp)
     pMode->RedMask = pMode->GreenMask << color_bits;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -3162,6 +3204,7 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::QueryCurrentMode(PVIDEO_MODE RequestedMode)
 {
     PAGED_CODE();
@@ -3171,6 +3214,7 @@ NTSTATUS QxlDevice::QueryCurrentMode(PVIDEO_MODE RequestedMode)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::SetCurrentMode(ULONG Mode)
 {
     PAGED_CODE();
@@ -3191,6 +3235,7 @@ NTSTATUS QxlDevice::SetCurrentMode(ULONG Mode)
     return STATUS_UNSUCCESSFUL;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::GetCurrentMode(ULONG* pMode)
 {
     PAGED_CODE();
@@ -3201,6 +3246,7 @@ NTSTATUS QxlDevice::GetCurrentMode(ULONG* pMode)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::SetPowerState(_In_ DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -3217,6 +3263,7 @@ NTSTATUS QxlDevice::SetPowerState(_In_ DEVICE_POWER_STATE DevicePowerState, DXGK
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -3365,6 +3412,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
     return QxlInit(pDispInfo);
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::QxlInit(DXGK_DISPLAY_INFORMATION* pDispInfo)
 {
     PAGED_CODE();
@@ -3393,12 +3441,14 @@ NTSTATUS QxlDevice::QxlInit(DXGK_DISPLAY_INFORMATION* pDispInfo)
     return Status;
 }
 
+QXL_PAGED
 void QxlDevice::QxlClose()
 {
     PAGED_CODE();
     DestroyMemSlots();
 }
 
+QXL_PAGED
 void QxlDevice::UnmapMemory(void)
 {
     PAGED_CODE();
@@ -3427,6 +3477,7 @@ void QxlDevice::UnmapMemory(void)
     }
 }
 
+QXL_PAGED
 BOOL QxlDevice::InitMemSlots(void)
 {
     PAGED_CODE();
@@ -3447,6 +3498,7 @@ BOOL QxlDevice::InitMemSlots(void)
     return FALSE;
 }
 
+QXL_PAGED
 void QxlDevice::DestroyMemSlots(void)
 {
     PAGED_CODE();
@@ -3456,6 +3508,7 @@ void QxlDevice::DestroyMemSlots(void)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::CreatePrimarySurface(PVIDEO_MODE_INFORMATION pModeInfo)
 {
     PAGED_CODE();
@@ -3479,6 +3532,7 @@ void QxlDevice::CreatePrimarySurface(PVIDEO_MODE_INFORMATION pModeInfo)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::DestroyPrimarySurface(void)
 {
     PAGED_CODE();
@@ -3488,6 +3542,7 @@ void QxlDevice::DestroyPrimarySurface(void)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 _inline QXLPHYSICAL QxlDevice::PA(PVOID virt, UINT8 slot_id)
 {
     PAGED_CODE();
@@ -3496,6 +3551,7 @@ _inline QXLPHYSICAL QxlDevice::PA(PVOID virt, UINT8 slot_id)
     return pSlot->high_bits | ((UINT64)virt - pSlot->start_virt_addr);
 }
 
+QXL_PAGED
 _inline UINT64 QxlDevice::VA(QXLPHYSICAL paddr, UINT8 slot_id)
 {
     PAGED_CODE();
@@ -3509,6 +3565,7 @@ _inline UINT64 QxlDevice::VA(QXLPHYSICAL paddr, UINT8 slot_id)
     return virt;
 }
 
+QXL_PAGED
 void QxlDevice::SetupHWSlot(UINT8 Idx, MemSlot *pSlot)
 {
     PAGED_CODE();
@@ -3519,6 +3576,7 @@ void QxlDevice::SetupHWSlot(UINT8 Idx, MemSlot *pSlot)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<---> %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 BOOL QxlDevice::CreateEvents()
 {
     PAGED_CODE();
@@ -3541,6 +3599,7 @@ BOOL QxlDevice::CreateEvents()
     return TRUE;
 }
 
+QXL_PAGED
 BOOL QxlDevice::CreateRings()
 {
     PAGED_CODE();
@@ -3552,6 +3611,7 @@ BOOL QxlDevice::CreateRings()
     return TRUE;
 }
 
+QXL_PAGED
 void QxlDevice::AsyncIo(UCHAR  Port, UCHAR Value)
 {
     PAGED_CODE();
@@ -3564,6 +3624,7 @@ void QxlDevice::AsyncIo(UCHAR  Port, UCHAR Value)
     ReleaseMutex(&m_IoLock, locked);
 }
 
+QXL_PAGED
 void QxlDevice::SyncIo(UCHAR  Port, UCHAR Value)
 {
     PAGED_CODE();
@@ -3573,6 +3634,7 @@ void QxlDevice::SyncIo(UCHAR  Port, UCHAR Value)
     ReleaseMutex(&m_IoLock, locked);
 }
 
+QXL_PAGED
 UINT8 QxlDevice::SetupMemSlot(UINT8 Idx, UINT64 pastart, UINT64 paend, UINT64 vastart, UINT64 vaend)
 {
     PAGED_CODE();
@@ -3599,6 +3661,7 @@ UINT8 QxlDevice::SetupMemSlot(UINT8 Idx, UINT64 pastart, UINT64 paend, UINT64 va
     return slot_index;
 }
 
+QXL_PAGED
 BOOL QxlDevice::CreateMemSlots(void)
 {
     PAGED_CODE();
@@ -3619,6 +3682,7 @@ BOOL QxlDevice::CreateMemSlots(void)
     return TRUE;
 }
 
+QXL_PAGED
 void QxlDevice::InitDeviceMemoryResources(void)
 {
     PAGED_CODE();
@@ -3628,6 +3692,7 @@ void QxlDevice::InitDeviceMemoryResources(void)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::InitMonitorConfig(void)
 {
     PAGED_CODE();
@@ -3639,6 +3704,7 @@ void QxlDevice::InitMonitorConfig(void)
     *m_monitor_config_pa = PA(m_monitor_config, m_MainMemSlot);
 }
 
+QXL_PAGED
 void QxlDevice::InitMspace(UINT32 mspace_type, UINT8 *start, size_t capacity)
 {
     PAGED_CODE();
@@ -3657,6 +3723,7 @@ void QxlDevice::ResetDevice(void)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 NTSTATUS
 QxlDevice::ExecutePresentDisplayOnly(
     _In_ BYTE*             DstAddr,
@@ -3845,6 +3912,7 @@ QxlDevice::ExecutePresentDisplayOnly(
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 void QxlDevice::WaitForReleaseRing(void)
 {
     PAGED_CODE();
@@ -3878,6 +3946,7 @@ void QxlDevice::WaitForReleaseRing(void)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("%s: <---\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::FlushReleaseRing()
 {
     PAGED_CODE();
@@ -3910,6 +3979,7 @@ void QxlDevice::FlushReleaseRing()
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::EmptyReleaseRing()
 {
     PAGED_CODE();
@@ -3921,6 +3991,7 @@ void QxlDevice::EmptyReleaseRing()
     ReleaseMutex(&m_MemLock, locked);
 }
 
+QXL_PAGED
 UINT64 QxlDevice::ReleaseOutput(UINT64 output_id)
 {
     PAGED_CODE();
@@ -3941,6 +4012,7 @@ UINT64 QxlDevice::ReleaseOutput(UINT64 output_id)
     return next;
 }
 
+QXL_PAGED
 void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force)
 {
     PAGED_CODE();
@@ -3990,6 +4062,7 @@ void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force)
     return ptr;
 }
 
+QXL_PAGED
 void QxlDevice::FreeMem(UINT32 mspace_type, void *ptr)
 {
     PAGED_CODE();
@@ -4011,6 +4084,7 @@ void QxlDevice::FreeMem(UINT32 mspace_type, void *ptr)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 QXLDrawable *QxlDevice::GetDrawable()
 {
     PAGED_CODE();
@@ -4024,6 +4098,7 @@ QXLDrawable *QxlDevice::GetDrawable()
     return(QXLDrawable *)output->data;
 }
 
+QXL_PAGED
 QXLCursorCmd *QxlDevice::CursorCmd()
 {
     PAGED_CODE();
@@ -4040,6 +4115,7 @@ QXLCursorCmd *QxlDevice::CursorCmd()
     return cursor_cmd;
 }
 
+QXL_PAGED
 BOOL QxlDevice::SetClip(const RECT *clip, QXLDrawable *drawable)
 {
     PAGED_CODE();
@@ -4070,6 +4146,7 @@ BOOL QxlDevice::SetClip(const RECT *clip, QXLDrawable *drawable)
     return TRUE;
 }
 
+QXL_PAGED
 void QxlDevice::AddRes(QXLOutput *output, Resource *res)
 {
     PAGED_CODE();
@@ -4077,6 +4154,7 @@ void QxlDevice::AddRes(QXLOutput *output, Resource *res)
     output->resources[output->num_res++] = res;
 }
 
+QXL_PAGED
 void QxlDevice::DrawableAddRes(QXLDrawable *drawable, Resource *res)
 {
     PAGED_CODE();
@@ -4086,6 +4164,7 @@ void QxlDevice::DrawableAddRes(QXLDrawable *drawable, Resource *res)
     AddRes(output, res);
 }
 
+QXL_PAGED
 void QxlDevice::CursorCmdAddRes(QXLCursorCmd *cmd, Resource *res)
 {
     PAGED_CODE();
@@ -4095,6 +4174,7 @@ void QxlDevice::CursorCmdAddRes(QXLCursorCmd *cmd, Resource *res)
     AddRes(output, res);
 }
 
+QXL_PAGED
 void QxlDevice::FreeClipRectsEx(Resource *res)
 {
     PAGED_CODE();
@@ -4103,6 +4183,7 @@ void QxlDevice::FreeClipRectsEx(Resource *res)
     pqxl->FreeClipRects(res);
 }
 
+QXL_PAGED
 void QxlDevice::FreeClipRects(Resource *res)
 {
     PAGED_CODE();
@@ -4119,6 +4200,7 @@ void QxlDevice::FreeClipRects(Resource *res)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::FreeBitmapImageEx(Resource *res)
 {
     PAGED_CODE();
@@ -4127,6 +4209,7 @@ void QxlDevice::FreeBitmapImageEx(Resource *res)
     pqxl->FreeBitmapImage(res);
 }
 
+QXL_PAGED
 void QxlDevice::FreeBitmapImage(Resource *res)
 {
     PAGED_CODE();
@@ -4147,6 +4230,7 @@ void QxlDevice::FreeBitmapImage(Resource *res)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::FreeCursorEx(Resource *res)
 {
     PAGED_CODE();
@@ -4155,6 +4239,7 @@ void QxlDevice::FreeCursorEx(Resource *res)
     pqxl->FreeCursor(res);
 }
 
+QXL_PAGED
 void QxlDevice::FreeCursor(Resource *res)
 {
     PAGED_CODE();
@@ -4172,6 +4257,7 @@ void QxlDevice::FreeCursor(Resource *res)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 QXLDrawable *QxlDevice::Drawable(UINT8 type, CONST RECT *area, CONST RECT *clip, UINT32 surface_id)
 {
     PAGED_CODE();
@@ -4200,6 +4286,7 @@ QXLDrawable *QxlDevice::Drawable(UINT8 type, CONST RECT *area, CONST RECT *clip,
     return drawable;
 }
 
+QXL_PAGED
 void QxlDevice::PushDrawable(QXLDrawable *drawable) {
     PAGED_CODE();
     QXLCommand *cmd;
@@ -4216,6 +4303,7 @@ void QxlDevice::PushDrawable(QXLDrawable *drawable) {
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 void QxlDevice::PushCursorCmd(QXLCursorCmd *cursor_cmd)
 {
     PAGED_CODE();
@@ -4234,6 +4322,7 @@ void QxlDevice::PushCursorCmd(QXLCursorCmd *cursor_cmd)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 VOID QxlDevice::SetImageId(InternalImage *internal,
     BOOL cache_me,
     LONG width,
@@ -4254,6 +4343,7 @@ VOID QxlDevice::SetImageId(InternalImage *internal,
     }
 }
 
+QXL_PAGED
 VOID QxlDevice::BltBits (
     BLT_INFO* pDst,
     CONST BLT_INFO* pSrc,
@@ -4355,6 +4445,7 @@ VOID QxlDevice::BltBits (
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+    QXL_PAGED
 VOID QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
                             UINT8 **end_ptr, UINT8 *src, int size,
                             size_t alloc_size, uint32_t alignment)
@@ -4395,6 +4486,7 @@ VOID QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 VOID QxlDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
 {
     QXLDrawable *drawable;
@@ -4422,6 +4514,7 @@ VOID QxlDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
     }
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::HWClose(void)
 {
     PAGED_CODE();
@@ -4430,6 +4523,7 @@ NTSTATUS QxlDevice::HWClose(void)
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape)
 {
     PAGED_CODE();
@@ -4514,6 +4608,7 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition)
 {
     PAGED_CODE();
@@ -4538,6 +4633,7 @@ NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pS
     return STATUS_SUCCESS;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::UpdateChildStatus(BOOLEAN connect)
 {
     PAGED_CODE();
@@ -4552,6 +4648,7 @@ NTSTATUS QxlDevice::UpdateChildStatus(BOOLEAN connect)
     return Status;
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::SetCustomDisplay(QXLEscapeSetCustomDisplay* custom_display)
 {
     PAGED_CODE();
@@ -4576,6 +4673,7 @@ NTSTATUS QxlDevice::SetCustomDisplay(QXLEscapeSetCustomDisplay* custom_display)
     return status;
 }
 
+QXL_PAGED
 void QxlDevice::SetMonitorConfig(QXLHead * monitor_config)
 {
     PAGED_CODE();
@@ -4592,6 +4690,7 @@ void QxlDevice::SetMonitorConfig(QXLHead * monitor_config)
     AsyncIo(QXL_IO_MONITORS_CONFIG_ASYNC, 0);
 }
 
+QXL_PAGED
 NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscape)
 {
     PAGED_CODE();
@@ -4633,6 +4732,7 @@ NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscape)
     return status;
 }
 
+QXL_PAGED
 VOID QxlDevice::WaitForCmdRing()
 {
     PAGED_CODE();
@@ -4650,6 +4750,7 @@ VOID QxlDevice::WaitForCmdRing()
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
+QXL_PAGED
 VOID QxlDevice::PushCmd()
 {
     PAGED_CODE();
@@ -4662,6 +4763,7 @@ VOID QxlDevice::PushCmd()
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s notify = %d\n", __FUNCTION__, notify));
 }
 
+QXL_PAGED
 VOID QxlDevice::WaitForCursorRing(VOID)
 {
     PAGED_CODE();
@@ -4685,6 +4787,7 @@ VOID QxlDevice::WaitForCursorRing(VOID)
     }
 }
 
+QXL_PAGED
 VOID QxlDevice::PushCursor(VOID)
 {
     PAGED_CODE();
@@ -4804,6 +4907,7 @@ D3DDDIFORMAT PixelFormatFromBPP(UINT BPP)
     }
 }
 
+QXL_PAGED
 UINT SpiceFromPixelFormat(D3DDDIFORMAT Format)
 {
     PAGED_CODE();
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index c808eb1..ac33faa 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -4,6 +4,8 @@
 #include "qxl_windows.h"
 #include "mspace.h"
 
+#define QXL_PAGED __declspec(code_seg("PAGE"))
+
 #define MAX_CHILDREN               1
 #define MAX_VIEWS                  1
 #define BITS_PER_BYTE              8
@@ -215,12 +217,19 @@ class QxlDod;
 
 class HwDeviceInterface {
 public:
+    QXL_PAGED
     virtual ~HwDeviceInterface() {;}
+    QXL_PAGED
     virtual NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode) = 0;
+    QXL_PAGED
     virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0;
+    QXL_PAGED
     virtual NTSTATUS GetCurrentMode(ULONG* Mode) = 0;
+    QXL_PAGED
     virtual NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
+    QXL_PAGED
     virtual NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
+    QXL_PAGED
     virtual NTSTATUS HWClose(void) = 0;
     virtual BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_  ULONG MessageNumber) = 0;
     virtual VOID DpcRoutine(PVOID) = 0;
@@ -228,12 +237,19 @@ public:
     virtual NTSTATUS AcquireFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode) { return STATUS_SUCCESS; }
     virtual NTSTATUS ReleaseFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode) { return STATUS_SUCCESS; }
 
+    QXL_PAGED
     virtual ULONG GetModeCount(void) = 0;
+    QXL_PAGED
     PVIDEO_MODE_INFORMATION GetModeInfo(UINT idx) {return &m_ModeInfo[idx];}
+    QXL_PAGED
     USHORT GetModeNumber(USHORT idx) {return m_ModeNumbers[idx];}
+    QXL_PAGED
     USHORT GetCurrentModeIndex(void) {return m_CurrentMode;}
+    QXL_PAGED
     VOID SetCurrentModeIndex(USHORT idx) {m_CurrentMode = idx;}
+    QXL_PAGED
     virtual BOOLEAN EnablePointer(void) = 0;
+    QXL_PAGED
     virtual NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*             DstAddr,
                                  _In_ UINT              DstBitPerPixel,
                                  _In_ BYTE*             SrcAddr,
@@ -245,13 +261,17 @@ public:
                                  _In_ RECT*             pDirtyRect,
                                  _In_ D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation,
                                  _In_ const CURRENT_BDD_MODE* pModeCur) = 0;
-
+    QXL_PAGED
     virtual VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod) = 0;
+    QXL_PAGED
     virtual NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape) = 0;
+    QXL_PAGED
     virtual NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition) = 0;
+    QXL_PAGED
     virtual NTSTATUS Escape(_In_ CONST DXGKARG_ESCAPE* pEscap) = 0;
     ULONG GetId(void) { return m_Id; }
 protected:
+    QXL_PAGED
     virtual NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
 protected:
     QxlDod* m_pQxlDod;
@@ -267,16 +287,27 @@ class VgaDevice  :
     public HwDeviceInterface
 {
 public:
+    QXL_PAGED
     VgaDevice(_In_ QxlDod* pQxlDod);
+    QXL_PAGED
     ~VgaDevice(void);
+    QXL_PAGED
     NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode);
+    QXL_PAGED
     NTSTATUS SetCurrentMode(ULONG Mode);
+    QXL_PAGED
     NTSTATUS GetCurrentMode(ULONG* Mode);
+    QXL_PAGED
     ULONG GetModeCount(void) {return m_ModeCount;}
+    QXL_PAGED
     NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo);
+    QXL_PAGED
     NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo);
+    QXL_PAGED
     NTSTATUS HWClose(void);
+    QXL_PAGED
     BOOLEAN EnablePointer(void) { return TRUE; }
+    QXL_PAGED
     NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*             DstAddr,
                                  _In_ UINT              DstBitPerPixel,
                                  _In_ BYTE*             SrcAddr,
@@ -288,18 +319,24 @@ public:
                                  _In_ RECT*             pDirtyRect,
                                  _In_ D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation,
                                  _In_ const CURRENT_BDD_MODE* pModeCur);
+    QXL_PAGED
     VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod);
     BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_  ULONG MessageNumber);
     VOID DpcRoutine(PVOID);
     VOID ResetDevice(VOID);
     NTSTATUS AcquireFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode);
     NTSTATUS ReleaseFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode);
+    QXL_PAGED
     NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape);
+    QXL_PAGED
     NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition);
+    QXL_PAGED
     NTSTATUS Escape(_In_ CONST DXGKARG_ESCAPE* pEscap);
 protected:
+    QXL_PAGED
     NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo);
 private:
+    QXL_PAGED
     BOOL SetVideoModeInfo(UINT Idx, PVBE_MODEINFO pModeInfo);
 };
 
@@ -442,16 +479,27 @@ class QxlDevice  :
     public HwDeviceInterface
 {
 public:
+    QXL_PAGED
     QxlDevice(_In_ QxlDod* pQxlDod);
+    QXL_PAGED
     ~QxlDevice(void);
+    QXL_PAGED
     NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode);
+    QXL_PAGED
     NTSTATUS SetCurrentMode(ULONG Mode);
+    QXL_PAGED
     NTSTATUS GetCurrentMode(ULONG* Mode);
+    QXL_PAGED
     ULONG GetModeCount(void) {return m_ModeCount;}
+    QXL_PAGED
     NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo);
+    QXL_PAGED
     NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo);
+    QXL_PAGED
     NTSTATUS HWClose(void);
+    QXL_PAGED
     BOOLEAN EnablePointer(void) { return FALSE; }
+    QXL_PAGED
     NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*             DstAddr,
                     _In_ UINT              DstBitPerPixel,
                     _In_ BYTE*             SrcAddr,
@@ -463,83 +511,140 @@ public:
                     _In_ RECT*             pDirtyRect,
                     _In_ D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation,
                     _In_ const CURRENT_BDD_MODE* pModeCur);
+    QXL_PAGED
     VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod);
     BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_  ULONG MessageNumber);
     VOID DpcRoutine(PVOID);
     VOID ResetDevice(VOID);
+    QXL_PAGED
     NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape);
+    QXL_PAGED
     NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition);
+    QXL_PAGED
     NTSTATUS Escape(_In_ CONST DXGKARG_ESCAPE* pEscap);
 protected:
+    QXL_PAGED
     NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo);
+    QXL_PAGED
     VOID BltBits (BLT_INFO* pDst,
                     CONST BLT_INFO* pSrc,
                     UINT  NumRects,
                     _In_reads_(NumRects) CONST RECT *pRects,
                     POINT*   pSourcePoint);
+    QXL_PAGED
     QXLDrawable *Drawable(UINT8 type,
                     CONST RECT *area,
                     CONST RECT *clip,
                     UINT32 surface_id);
+    QXL_PAGED
     void PushDrawable(QXLDrawable *drawable);
+    QXL_PAGED
     void PushCursorCmd(QXLCursorCmd *cursor_cmd);
+    QXL_PAGED
     QXLDrawable *GetDrawable();
+    QXL_PAGED
     QXLCursorCmd *CursorCmd();
+    QXL_PAGED
     void *AllocMem(UINT32 mspace_type, size_t size, BOOL force);
     VOID UpdateArea(CONST RECT* area, UINT32 surface_id);
+    QXL_PAGED
     VOID SetImageId(InternalImage *internal,
                     BOOL cache_me,
                     LONG width,
                     LONG height,
                     UINT8 format, UINT32 key);
 private:
+    QXL_PAGED
     NTSTATUS QxlInit(DXGK_DISPLAY_INFORMATION* pDispInfo);
+    QXL_PAGED
     void QxlClose(void);
+    QXL_PAGED
     void UnmapMemory(void);
+    QXL_PAGED
     BOOL SetVideoModeInfo(UINT Idx, QXLMode* pModeInfo);
+    QXL_PAGED
     void UpdateVideoModeInfo(UINT Idx, UINT xres, UINT yres, UINT bpp);
+    QXL_PAGED
     BOOL InitMemSlots(void);
+    QXL_PAGED
     BOOL CreateMemSlots(void);
+    QXL_PAGED
     void DestroyMemSlots(void);
+    QXL_PAGED
     void CreatePrimarySurface(PVIDEO_MODE_INFORMATION pModeInfo);
+    QXL_PAGED
     void DestroyPrimarySurface(void);
+    QXL_PAGED
     void SetupHWSlot(UINT8 Idx, MemSlot *pSlot);
+    QXL_PAGED
     UINT8 SetupMemSlot(UINT8 Idx, UINT64 pastart, UINT64 paend, UINT64 vastart, UINT64 vaend);
+    QXL_PAGED
     BOOL CreateEvents(void);
+    QXL_PAGED
     BOOL CreateRings(void);
+    QXL_PAGED
     UINT64 VA(QXLPHYSICAL paddr, UINT8 slot_id);
+    QXL_PAGED
     QXLPHYSICAL PA(PVOID virt, UINT8 slot_id);
+    QXL_PAGED
     void InitDeviceMemoryResources(void);
+    QXL_PAGED
     void InitMonitorConfig();
+    QXL_PAGED
     void InitMspace(UINT32 mspace_type, UINT8 *start, size_t capacity);
+    QXL_PAGED
     void FlushReleaseRing();
+    QXL_PAGED
     void FreeMem(UINT32 mspace_type, void *ptr);
+    QXL_PAGED
     UINT64 ReleaseOutput(UINT64 output_id);
+    QXL_PAGED
     void WaitForReleaseRing(void);
+    QXL_PAGED
     void EmptyReleaseRing(void);
+    QXL_PAGED
     BOOL SetClip(const RECT *clip, QXLDrawable *drawable);
+    QXL_PAGED
     void AddRes(QXLOutput *output, Resource *res);
+    QXL_PAGED
     void DrawableAddRes(QXLDrawable *drawable, Resource *res);
+    QXL_PAGED
     void CursorCmdAddRes(QXLCursorCmd *cmd, Resource *res);
+    QXL_PAGED
     void FreeClipRects(Resource *res);
+    QXL_PAGED
     void static FreeClipRectsEx(Resource *res);
+    QXL_PAGED
     void FreeBitmapImage(Resource *res);
+    QXL_PAGED
     void static FreeBitmapImageEx(Resource *res);
+    QXL_PAGED
     void static FreeCursorEx(Resource *res);
+    QXL_PAGED
     void FreeCursor(Resource *res);
+    QXL_PAGED
     void WaitForCmdRing(void);
+    QXL_PAGED
     void PushCmd(void);
+    QXL_PAGED
     void WaitForCursorRing(void);
+    QXL_PAGED
     void PushCursor(void);
+    QXL_PAGED
     void PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
                             UINT8 **end_ptr, UINT8 *src, int size,
                             size_t alloc_size, uint32_t alignment);
     BOOLEAN static DpcCallbackEx(PVOID);
     void DpcCallback(PDPC_CB_CONTEXT);
+    QXL_PAGED
     void AsyncIo(UCHAR  Port, UCHAR Value);
+    QXL_PAGED
     void SyncIo(UCHAR  Port, UCHAR Value);
+    QXL_PAGED
     NTSTATUS UpdateChildStatus(BOOLEAN connect);
+    QXL_PAGED
     NTSTATUS SetCustomDisplay(QXLEscapeSetCustomDisplay* custom_display);
+    QXL_PAGED
     void SetMonitorConfig(QXLHead* monitor_config);
 
 private:
@@ -610,37 +715,41 @@ private:
     DWORD m_VgaCompatible;
     DWORD m_PointerCaps;
 public:
+    QXL_PAGED
     QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject);
+    QXL_PAGED
     ~QxlDod(void);
-#pragma code_seg(push)
-#pragma code_seg()
     BOOLEAN IsDriverActive() const
     {
         return m_Flags.DriverStarted;
     }
-#pragma code_seg(pop)
-
+    QXL_PAGED
     NTSTATUS StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
                          _In_  DXGKRNL_INTERFACE* pDxgkInterface,
                          _Out_ ULONG*             pNumberOfViews,
                          _Out_ ULONG*             pNumberOfChildren);
+    QXL_PAGED
     NTSTATUS StopDevice(VOID);
     // Must be Non-Paged
     VOID ResetDevice(VOID);
 
+    QXL_PAGED
     NTSTATUS DispatchIoRequest(_In_  ULONG VidPnSourceId,
                                _In_  VIDEO_REQUEST_PACKET* pVideoRequestPacket);
+    QXL_PAGED
     NTSTATUS SetPowerState(_In_  ULONG HardwareUid,
                                _In_  DEVICE_POWER_STATE DevicePowerState,
                                _In_  POWER_ACTION       ActionType);
     // Report back child capabilities
+    QXL_PAGED
     NTSTATUS QueryChildRelations(_Out_writes_bytes_(ChildRelationsSize) DXGK_CHILD_DESCRIPTOR* pChildRelations,
                                  _In_                             ULONG                  ChildRelationsSize);
-
+    QXL_PAGED
     NTSTATUS QueryChildStatus(_Inout_ DXGK_CHILD_STATUS* pChildStatus,
                               _In_    BOOLEAN            NonDestructiveOnly);
 
     // Return EDID if previously retrieved
+    QXL_PAGED
     NTSTATUS QueryDeviceDescriptor(_In_    ULONG                   ChildUid,
                                    _Inout_ DXGK_DEVICE_DESCRIPTOR* pDeviceDescriptor);
 
@@ -651,37 +760,53 @@ public:
     VOID DpcRoutine(VOID);
 
     // Return DriverCaps, doesn't support other queries though
+    QXL_PAGED
     NTSTATUS QueryAdapterInfo(_In_ CONST DXGKARG_QUERYADAPTERINFO* pQueryAdapterInfo);
 
+    QXL_PAGED
     NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition);
 
+    QXL_PAGED
     NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape);
 
+    QXL_PAGED
     NTSTATUS Escape(_In_ CONST DXGKARG_ESCAPE* pEscape);
 
+    QXL_PAGED
     NTSTATUS PresentDisplayOnly(_In_ CONST DXGKARG_PRESENT_DISPLAYONLY* pPresentDisplayOnly);
 
+    QXL_PAGED
     NTSTATUS QueryInterface(_In_ CONST PQUERY_INTERFACE     QueryInterface);
 
+    QXL_PAGED
     NTSTATUS IsSupportedVidPn(_Inout_ DXGKARG_ISSUPPORTEDVIDPN* pIsSupportedVidPn);
 
+    QXL_PAGED
     NTSTATUS RecommendFunctionalVidPn(_In_ CONST DXGKARG_RECOMMENDFUNCTIONALVIDPN* CONST pRecommendFunctionalVidPn);
 
+    QXL_PAGED
     NTSTATUS RecommendVidPnTopology(_In_ CONST DXGKARG_RECOMMENDVIDPNTOPOLOGY* CONST pRecommendVidPnTopology);
 
+    QXL_PAGED
     NTSTATUS RecommendMonitorModes(_In_ CONST DXGKARG_RECOMMENDMONITORMODES* CONST pRecommendMonitorModes);
 
+    QXL_PAGED
     NTSTATUS EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModality);
 
+    QXL_PAGED
     NTSTATUS SetVidPnSourceVisibility(_In_ CONST DXGKARG_SETVIDPNSOURCEVISIBILITY* pSetVidPnSourceVisibility);
 
+    QXL_PAGED
     NTSTATUS CommitVidPn(_In_ CONST DXGKARG_COMMITVIDPN* CONST pCommitVidPn);
 
+    QXL_PAGED
     NTSTATUS UpdateActiveVidPnPresentPath(_In_ CONST DXGKARG_UPDATEACTIVEVIDPNPRESENTPATH* CONST pUpdateActiveVidPnPresentPath);
 
+    QXL_PAGED
     NTSTATUS QueryVidPnHWCapability(_Inout_ DXGKARG_QUERYVIDPNHWCAPABILITY* pVidPnHWCaps);
 
     // Part of PnPStop (PnP instance only), returns current mode information (which will be passed to fallback instance by dxgkrnl)
+    QXL_PAGED
     NTSTATUS StopDeviceAndReleasePostDisplayOwnership(_In_  D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
                                                       _Out_ DXGK_DISPLAY_INFORMATION*      pDisplayInfo);
 
@@ -703,39 +828,52 @@ public:
                                  _In_                                     INT   PositionY);
     PDXGKRNL_INTERFACE GetDxgkInterface(void) { return &m_DxgkInterface;}
 private:
+    QXL_PAGED
     VOID CleanUp(VOID);
+    QXL_PAGED
     NTSTATUS CheckHardware();
+    QXL_PAGED
     NTSTATUS WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR pszwValueName, _In_ PCSTR pszValue);
     // Set the given source mode on the given path
+    QXL_PAGED
     NTSTATUS SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode,
                                   CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath);
 
     // Add the current mode to the given monitor source mode set
+    QXL_PAGED
     NTSTATUS AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES* CONST pRecommendMonitorModes);
 
     // Add the current mode to the given VidPn source mode set
+    QXL_PAGED
     NTSTATUS AddSingleSourceMode(_In_ CONST DXGK_VIDPNSOURCEMODESET_INTERFACE* pVidPnSourceModeSetInterface,
                                  D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet,
                                  D3DDDI_VIDEO_PRESENT_SOURCE_ID SourceId);
 
     // Add the current mode (or the matching to pinned source mode) to the give VidPn target mode set
+    QXL_PAGED
     NTSTATUS AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface,
                                  D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet,
                                  _In_opt_ CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnPinnedSourceModeInfo,
                                  D3DDDI_VIDEO_PRESENT_SOURCE_ID SourceId);
     D3DDDI_VIDEO_PRESENT_SOURCE_ID FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero);
+    QXL_PAGED
     NTSTATUS IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const;
+    QXL_PAGED
     NTSTATUS IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const;
+    QXL_PAGED
     NTSTATUS RegisterHWInfo(_In_ ULONG Id);
+    QXL_PAGED
     NTSTATUS ReadConfiguration();
 };
 
+QXL_PAGED
 NTSTATUS
 MapFrameBuffer(
     _In_                PHYSICAL_ADDRESS    PhysicalAddress,
     _In_                ULONG               Length,
     _Outptr_result_bytebuffer_(Length) VOID**              VirtualAddress);
 
+QXL_PAGED
 NTSTATUS
 UnmapFrameBuffer(
     _In_reads_bytes_(Length) VOID* VirtualAddress,
@@ -743,6 +881,7 @@ UnmapFrameBuffer(
 
 UINT BPPFromPixelFormat(D3DDDIFORMAT Format);
 D3DDDIFORMAT PixelFormatFromBPP(UINT BPP);
+QXL_PAGED
 UINT SpiceFromPixelFormat(D3DDDIFORMAT Format);
 
 VOID CopyBitsGeneric(
-- 
2.7.4



More information about the Spice-devel mailing list