Re: [PATCH qxl-wddm-dod 06/26] Add functions called from non-pageable functions to non-paged segments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> From: Sandy Stutsman <sstutsma@xxxxxxxxxx>
> 
> Found by Driver Verifier

I would avoid to move function and just add #pragma code_seg(s)

Frediano

> ---
>  qxldod/QxlDod.cpp | 55
>  ++++++++++++++++++++++++++++++++-----------------------
>  1 file changed, 32 insertions(+), 23 deletions(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 1225f04..1b3bdf1 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -44,6 +44,7 @@ BYTE PixelMask[BITS_PER_BYTE]  = {0x80, 0x40, 0x20, 0x10,
> 0x08, 0x04, 0x02, 0x01
>  
>  #pragma code_seg(pop)
>  
> +#pragma code_seg("PAGE")
>  
>  
>  QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) :
>  m_pPhysicalDevice(pPhysicalDeviceObject),
> @@ -1916,6 +1917,20 @@ NTSTATUS QxlDod::RegisterHWInfo(ULONG Id)
>  //
>  #pragma code_seg(push)
>  #pragma code_seg()
> +
> +UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
> +{
> +    switch (Format) {
> +    case D3DDDIFMT_UNKNOWN: return 0;
> +    case D3DDDIFMT_P8: return 8;
> +    case D3DDDIFMT_R5G6B5: return 16;
> +    case D3DDDIFMT_R8G8B8: return 24;
> +    case D3DDDIFMT_X8R8G8B8: // fall through
> +    case D3DDDIFMT_A8R8G8B8: return 32;
> +    default: QXL_LOG_ASSERTION1("Unknown D3DDDIFORMAT 0x%I64x", Format);
> return 0;
> +    }
> +}
> +
>  D3DDDI_VIDEO_PRESENT_SOURCE_ID
>  QxlDod::FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
>  BOOLEAN DefaultToZero)
>  {
>      UNREFERENCED_PARAMETER(TargetId);
> @@ -1930,7 +1945,6 @@ 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
> @@ -2278,6 +2292,7 @@ VOID BltBits (
>          DbgPrint(TRACE_LEVEL_ERROR, ("Either dst (0x%I64x) or src (0x%I64x)
>          bits encountered exception during access.\n", pDst->pBits,
>          pSrc->pBits));
>      }
>  }
> +#pragma code_seg(pop) // End Non-Paged Code
>  
>  VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
>  {
> @@ -2862,6 +2877,9 @@ VOID VgaDevice::BlackOutScreen(CURRENT_BDD_MODE*
> pCurrentBddMod)
>      pCurrentBddMod->ZeroedOutStart.QuadPart = NewPhysAddrStart.QuadPart;
>      pCurrentBddMod->ZeroedOutEnd.QuadPart = NewPhysAddrEnd.QuadPart;
>  }
> +#pragma code_seg(push)
> +#pragma code_seg()
> +// BEGIN: Non-Paged Code Segment
>  
>  BOOLEAN VgaDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface,
>  _In_  ULONG MessageNumber)
>  {
> @@ -2877,6 +2895,7 @@ VOID VgaDevice::DpcRoutine(PVOID)
>  VOID VgaDevice::ResetDevice(VOID)
>  {
>  }
> +#pragma  code_seg(pop) //end non-paged code
>  
>  NTSTATUS  VgaDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE*
>  pSetPointerShape)
>  {
> @@ -3530,14 +3549,6 @@ void QxlDevice::InitMspace(UINT32 mspace_type, UINT8
> *start, size_t capacity)
>      DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s _mspace = %p\n", __FUNCTION__,
>      m_MSInfo[mspace_type]._mspace));
>  }
>  
> -void QxlDevice::ResetDevice(void)
> -{
> -    DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
> -    m_RamHdr->int_mask = ~0;
> -    WRITE_PORT_UCHAR(m_IoBase + QXL_IO_MEMSLOT_ADD, 0);
> -    DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
> -}
> -
>  NTSTATUS
>  QxlDevice::ExecutePresentDisplayOnly(
>      _In_ BYTE*             DstAddr,
> @@ -4484,6 +4495,9 @@ VOID QxlDevice::PushCursor(VOID)
>      DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s notify = %d\n", __FUNCTION__,
>      notify));
>  }
>  
> +#pragma code_seg(push)
> +#pragma code_seg()
> +// BEGIN: Non-Paged Code Segment
>  BOOLEAN QxlDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface,
>  _In_  ULONG MessageNumber)
>  {
>      UNREFERENCED_PARAMETER(MessageNumber);
> @@ -4543,6 +4557,15 @@ VOID QxlDevice::DpcRoutine(PVOID ptr)
>      DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));
>  }
>  
> +void QxlDevice::ResetDevice(void)
> +{
> +    DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
> +    m_RamHdr->int_mask = ~0;
> +    WRITE_PORT_UCHAR(m_IoBase + QXL_IO_MEMSLOT_ADD, 0);
> +    DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
> +}
> +#pragma code_seg(pop) //end non-paged code
> +
>  VOID QxlDevice::UpdateArea(CONST RECT* area, UINT32 surface_id)
>  {
>      DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
> @@ -4569,20 +4592,6 @@ VOID QxlDevice::DpcCallback(PDPC_CB_CONTEXT ctx)
>  
>  }
>  
> -UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
> -{
> -    switch (Format)
> -    {
> -        case D3DDDIFMT_UNKNOWN: return 0;
> -        case D3DDDIFMT_P8: return 8;
> -        case D3DDDIFMT_R5G6B5: return 16;
> -        case D3DDDIFMT_R8G8B8: return 24;
> -        case D3DDDIFMT_X8R8G8B8: // fall through
> -        case D3DDDIFMT_A8R8G8B8: return 32;
> -        default: QXL_LOG_ASSERTION1("Unknown D3DDDIFORMAT 0x%I64x", Format);
> return 0;
> -    }
> -}
> -
>  // Given bits per pixel, return the pixel format at the same bpp
>  D3DDDIFORMAT PixelFormatFromBPP(UINT BPP)
>  {

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]