[Spice-devel] [PATCH qxl-wddm-dod v4 04/10] Code Analysis fix

Frediano Ziglio fziglio at redhat.com
Mon Sep 12 09:47:06 UTC 2016


> 
> The PAGED_CODE macro ensures that the calling thread is running at an
> IRQL that is low enough to permit paging. A call to this macro should
> be made at the beginning of every driver routine that either contains
> pageable code or accesses pageable code.
> 
> Based on a patch by Sandy Stutsman <sstutsma at redhat.com>
> 
> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
> ---
>  qxldod/QxlDod.cpp | 89
>  ++++++++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 81 insertions(+), 8 deletions(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 93fd8c6..5659e87 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -3,7 +3,7 @@
>  #include "qxl_windows.h"
>  
>  #pragma code_seg(push)
> -#pragma code_seg()
> +#pragma code_seg("PAGE")
>  
>  #define WIN_QXL_INT_MASK ((QXL_INTERRUPT_DISPLAY) | \
>                            (QXL_INTERRUPT_CURSOR) | \
> @@ -61,6 +61,7 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) :
> m_pPhysicalDevice(pP
>                                                              m_MonitorPowerState(PowerDeviceD0),
>                                                              m_AdapterPowerState(PowerDeviceD0)
>  {
> +    PAGED_CODE();
>      DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
>      *((UINT*)&m_Flags) = 0;
>      RtlZeroMemory(&m_DxgkInterface, sizeof(m_DxgkInterface));

Looking at the final file looks like that code segments are not
set correctly.
In particular before this method there is a

  #pragma code_seg(pop)

line that reverts the segment to the default one which is non-paged
while this method is supposed to be paged.

Maybe using __declspec(code_seg...) could help? (or maybe I'm wrong).

Frediano


More information about the Spice-devel mailing list