how can pci memory mapped register be access in user mode

Dear all
I’m writing a PCI device driver. there are many registers in BAR0, have been mapped into driver in preparehardware routine. These registers often need to be access by application. if there is any method to share these registers into user mode?

I tried to use the following routine to map kernel memory to user mode. but register values are always 0xff
MmMapLockedPagesSpecifyCache(devExt->PMdlRegsBase, // MDL
UserMode, // Mode
MmCached, // Caching
NULL, // Address
FALSE, // Bugcheck?
NormalPagePriority); // Priority

If there is any method to let user mode access?

thank you very much

  1. You normally DO NOT map device registers cached. At most, they can be mapped write-combined.

  2. If you have to ask how to do that, you’re not quaified to map a device to user mode. There are issues of a proper cleanup on the abnormal application termination, foe example. What are you trying to achieve by accessing the device directly?

As in the other reply, there are methods to do this, but if you can’t figure
them out then there is a serious question of whether you have determined if
this is really needed.

When you say often need to be accessed, what is the rate of access? A
typical KMDF driver can handle 100,000 IOCTL’s a second, and with some
additional tricks that number can be pushed to 1,000,000 requests a second.
So are your applications hitting the register faster than this? If not
don’t go to mapping, there are cleanup and security holes.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Thursday, September 25, 2014 9:08 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] how can pci memory mapped register be access in user mode

Dear all
I’m writing a PCI device driver. there are many registers in BAR0, have
been mapped into driver in preparehardware routine. These registers often
need to be access by application. if there is any method to share these
registers into user mode?

I tried to use the following routine to map kernel memory to user mode. but
register values are always 0xff
MmMapLockedPagesSpecifyCache(devExt->PMdlRegsBase, // MDL
UserMode, // Mode
MmCached, // Caching
NULL, // Address
FALSE, // Bugcheck?
NormalPagePriority); // Priority

If there is any method to let user mode access?

thank you very much


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer