Driver Problems? Questions? Issues?
Put OSR's experience to work for you! Contact us for assistance with:
  • Creating the right design for your requirements
  • Reviewing your existing driver code
  • Analyzing driver reliability/performance issues
  • Custom training mixed with consulting and focused directly on your specific areas of interest/concern.
Check us out. OSR, the Windows driver experts.

Monthly Seminars at OSR Headquarters

East Coast USA
Windows Internals and SW Drivers, Dulles (Sterling) VA, 13 November 2017

Kernel Debugging & Crash Analysis for Windows, Nashua (Amherst) NH, 4 December 2017

Writing WDF Drivers I: Core Concepts, Nashua (Amherst) NH, 8 January 2018

WDF Drivers II: Advanced Implementation Techniques, Nashua (Amherst) NH, 15 January 2018


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 4  
08 Oct 17 21:48
Geoffrey McRae
xxxxxx@hostfission.com
Join Date: 08 Oct 2017
Posts To This List: 2
Mapping IO space to UserMode via CreateFileMapping

Hi All, I am writing some proof of concept code for KVM for communication between Windows 10 and a Host Linux system. What I have is a virtual RAM device that is actually connected to a shared memory segment on the Host. The PCIe BAR 2 is a direct mapping to this RAM. My intent is to provide a high bandwidth low latency means of transferring data that doesn't involve other common means used (sockets, etc). ZeroCopy would be ideal. So far I have pretty much everything working, I have written a driver that calls MmAllocateMdlForIoSpace and then maps the memory using MmMapLockedPagesSpecifyCache to user mode via a DeviceIOControl. This works perfectly, the user mode application is able to address the shared memory and write to it. What I am missing is the ability to use CreateFileMapping in user mode to obtain a HANDLE to a mapping of this memory. I am fairly new to windows driver programming and as such I am uncertain as to if this is even possible. Any pointers as to the best way to achieve this would be very helpful.
  Message 2 of 4  
08 Oct 17 22:10
anton bassov
xxxxxx@hotmail.com
Join Date: 16 Jul 2006
Posts To This List: 4384
Mapping IO space to UserMode via CreateFileMapping

<quote> What I am missing is the ability to use CreateFileMapping in user mode to obtain a HANDLE to a mapping of this memory. I am fairly new to windows driver programming and as such I am uncertain as to if this is even possible. Any pointers as to the best way to achieve this would be very helpful. </quote> You seem to confuse Windows with the OSes that provide mmap() call and think just of everything in existence either as of a file or of a process. Windows does not, and it does not have VFS either, so that flle mapping and file IO functions are two totally dfferent sets of API that rely upon two totally different subsystems, namely, Memory Manager and IO Manager respectively. Therefore, device mapping that is exposed to the userland via IOCTL mechanism is the only option that is available to you - you cannot use a section object for this purpose.... Anton Bassov
  Message 3 of 4  
08 Oct 17 22:41
Geoffrey McRae
xxxxxx@hostfission.com
Join Date: 08 Oct 2017
Posts To This List: 2
Mapping IO space to UserMode via CreateFileMapping

Hi Anton, Thanks for that, I thought that may be the case, but figured someone with much more experience in this field might have a magic bullet :)
  Message 4 of 4  
09 Oct 17 08:52
Mark Roddy
xxxxxx@gmail.com
Join Date: 25 Feb 2000
Posts To This List: 4012
Mapping IO space to UserMode via CreateFileMapping

MDL based IO can provide zero copy but you still need to initiate it with IOCTL requests. Mark Roddy On Sun, Oct 8, 2017 at 10:42 PM, xxxxx@hostfission.com <xxxxx@lists.osr.com> wrote: > Hi Anton, > > Thanks for that, I thought that may be the case, but figured someone with > much more experience in this field might have a magic bullet :) > > --- > NTDEV is sponsored by OSR > > Visit the list online at: <http://www.osronline.com/ > showlists.cfm?list=ntdev> <...excess quoted lines suppressed...> --
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 02:21.


Copyright ©2015, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license