[ros-dev] Memory Manager Patch to allow mapping of device memory into UserMode - please review.

Gregor Anich blight at blight.eu.org
Thu Mar 3 01:50:31 CET 2005


Hartmut Birr wrote:

> Gregor Anich schrieb:
>
>> Hi!
>>
>> I have changed the memory manager to allow mapping of sections from 
>> \Device\PhysicalMemory which are outside of RAM - this gets NVIDIA 
>> OpenGL working.
>> I hope my changes are correct (according to Hartmuts suggestions in 
>> this mail: 
>> http://reactos.com:8080/archives/public/ros-kernel/2004-August/004444.html) 
>>
>>
>> I changed MmProbeAndLockPages to set MDL_IO_SPACE in the MdlFlags of 
>> the Mdl if one of the Pfns described in the MDL is outside of the RAM 
>> (>= MmPageArraySize) which is then used in 
>> MmMapLockedPagesSpecifyCache to decide wether to call 
>> MmCreateVirtualMapping or MmCreateVirtualMappingUnsafe (in order to 
>> prevent bugchecks in mm/freelist.c when Pfns are checked against 
>> MmPageArraySize)
>>
>> - blight
>>
> Hi,
>
> I think that your patch isn't complete.
>
> - Mapping of physical memory for \Device\PhysicalMemory in section.c:
> We should use MmCreateVirtualMappingForKernel instead of 
> MmCreateVirtualMappingUnsafe because MmCreateVirtualMappingUnsafe 
> marks the pages as mapped in the pfn array. If 
> MmCreateVirtualMappingForKernel is used for mapping the pages, the 
> delete functions like MmUnmapViewOfxxx and MmFreeMemoryArea must also 
> use other functions.
>
> - Lock the pages with MmProbeAndLockPages in mdl.c:
> MmProbeAndLockPages may crash ros in some situations. On error there 
> is no check which unmap/unlock function must be use. Possible we must 
> check the type of the memory area for eache address and page.
>
> - Hartmut

Hi!

My reply comes a bit late ... I have taken a little break from OpenGL 
stuff , but today I looked at it again.

Why should MmCreateVirtualMappingForKernel be used instead of 
MmCreateVirtualMappingUnsafe in section.c? the whole point of my changes 
is to allow mapping of the device memory into usermode, which 
MmCreateVirtualMappingForKernel will not do as far as I can tell ;-), so 
I don't think that is needed or don't know what you mean.

I will do a bit more testing and send another patch soon I think.

 - blight


More information about the Ros-dev mailing list