开发者

Block Access to physical address on Windows

I'm accessing my memory-mapped device via a device-specific physical memory on the PC. This is done using a driver that maps a specific physical address to a pointer in linear memory on my proc开发者_Go百科ess address space.

I wanted to know if there is any way I can obtain a block the specific physical address and prevent other processes or devices from accessing this physical address?

The mapping of the physical address to linear one is done using a third party driver: TVicHW32.

EDIT: I can reproduce the scenario if I run 2 instances of my application with different flags. Both instances can access the same specific physical memory that is not a part of either process' memory space.


Youd driver must do the job by exposing a service (DeviceIoContro) that checks if a range is already mapped, maps it if it's free, and records the reservation. Also a service thar frees the reserver area and unmap it. And of course you should free all the areas related to a particular handle on close. Unfortunately there is a slight asymmetry in the mapping/unmapping services, since the "mapping" service is done via DeviceIoControl, so it taked the handle obtained at CreateFile time, but the mapped area is not directly connected to the device handle anymore. Of course, you can arrange you driver's "close" method to automate the unmapping (ZwUnmapViewOfSection...).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜