[Spice-devel] [PATCH qxl-wddm-dod v5 1/7] Use MmMapIoSpaceEx instead of MmMapIoSpace

Dmitry Fleytman dmitry at daynix.com
Tue Sep 27 09:57:33 UTC 2016


> On 27 Sep 2016, at 12:51 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> 
> On Mon, Sep 26, 2016 at 04:00:05PM +0300, Sameeh Jubran wrote:
>> Disable execution bit on mapping improving security.
>> 
>> MmMapIoSpaceEx is available only in Windows 10 thus
>> the macros are used.
> 
> Hey, looks good to me. Just one question, by default if this is built on
> a Windows 10 system, I guess MmMapIoSpaceEx is going to be used. However
> we can override NTDDI_VERSION to WIN8 if we want to build a driver which
> is going to work on both win8 and win10? Or is this working differently?

Hi Christophe,

Driver is built using WDK toolset for a specific OS.
There are WDK toolsets for windows 10, Windows 8.1, Windows 8 etc. 
NTDDI_VERSION defined by the toolset in accordance to target OS.

Currently we build with Windows 10 toolset only, but in future we may decide to build with Windows 8 or 8.1 toolset as well.

~Dmitry

> 
> Christophe
> 
>> 
>> Based on a patch by Sandy Stutsman <sstutsma at redhat.com>
>> 
>> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
>> ---
>> qxldod/QxlDod.cpp | 13 ++++++++++++-
>> 1 file changed, 12 insertions(+), 1 deletion(-)
>> 
>> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
>> index accf895..798b2f0 100755
>> --- a/qxldod/QxlDod.cpp
>> +++ b/qxldod/QxlDod.cpp
>> @@ -2009,17 +2009,28 @@ MapFrameBuffer(
>>         return STATUS_INVALID_PARAMETER;
>>     }
>> 
>> +#if NTDDI_VERSION >= NTDDI_WIN10
>> +    *VirtualAddress = MmMapIoSpaceEx(PhysicalAddress,
>> +        Length,
>> +        PAGE_WRITECOMBINE | PAGE_READWRITE);
>> +#else
>>     *VirtualAddress = MmMapIoSpace(PhysicalAddress,
>>                                    Length,
>>                                    MmWriteCombined);
>> +#endif
>>     if (*VirtualAddress == NULL)
>>     {
>>         // The underlying call to MmMapIoSpace failed. This may be because, MmWriteCombined
>>         // isn't supported, so try again with MmNonCached
>> -
>> +#if NTDDI_VERSION >= NTDDI_WIN10
>> +        *VirtualAddress = MmMapIoSpaceEx(PhysicalAddress,
>> +            Length,
>> +            (PAGE_NOCACHE | PAGE_READWRITE));
>> +#else
>>         *VirtualAddress = MmMapIoSpace(PhysicalAddress,
>>                                        Length,
>>                                        MmNonCached);
>> +#endif
>>         if (*VirtualAddress == NULL)
>>         {
>>             DbgPrint(TRACE_LEVEL_ERROR, ("MmMapIoSpace returned a NULL buffer when trying to allocate %lu bytes", Length));
>> -- 
>> 2.7.4
>> 
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org <mailto:Spice-devel at lists.freedesktop.org>
>> https://lists.freedesktop.org/mailman/listinfo/spice-devel <https://lists.freedesktop.org/mailman/listinfo/spice-devel>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160927/2151587c/attachment.html>


More information about the Spice-devel mailing list