rifter
论坛版主
论坛版主
  • 注册日期2002-03-20
  • 最后登录2006-02-28
  • 粉丝1
  • 关注0
  • 积分65分
  • 威望8点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
阅读:3024回复:4

MmGetSystemAddressForMdl都干了些什么呢?

楼主#
更多 发布于:2002-08-15 10:56
ds中的文档:
问几个问题,和ds无关

KMemory::MapToSystemSpace
PVOID MapToSystemSpace(void);

Map the memory region into system space.
                           ^^^^^^^^^^^^^指什么
Returns
Returns the virtual address in system space of the start of the memory region described by the object.

Comments
The pages of the described memory object must be locked. When a driver other than a highest level driver receives a KMemory object, it is safe to assume it is locked. Memory allocated from the non-paged pool is locked.

A driver that uses direct I/O but not DMA can use this service to map the buffer provided in a I/O request from a user subsystem. The driver can then transfer data directly to or from the client buffer.

If the underlying MDL has already been mapped, the function returns the same address to which it was originally mapped.

The underlying system service is MmGetSystemAddressForMdl.

The caller must be running at IRQL <= DISPATCH_LEVEL.


KMemory::MapToUserSpace
PVOID MapToUserSpace(void);

Map the memory region into the address space of the current process.

和上面的空间有什么区别呢???

Returns
Returns the virtual address in the current process address space of the start of the memory region described by the object. The address takes into account the page offset.

Comments
The pages of the described memory object must be locked. See LockPages. Memory allocated from the non-paged pool is locked.

Since the call maps the memory into the current process, only highest level drivers (including monolithic drivers) can reasonably use this function.

The same memory object may be mapped into multiple processes.

Use member function Unmap to unmap the memory mapped by this call.

The underlying system service is MmMapLockedPages.

The caller must be running at IRQL < DISPATCH_LEVEL.

See Also

LockPages, Unmap

See Also

LockPages

最新喜欢:

mapoflmapofl
分数 你想要吗?
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
沙发#
发布于:2002-08-15 11:46
ds中的文档:
问几个问题,和ds无关

KMemory::MapToSystemSpace
PVOID MapToSystemSpace(void);

Map the memory region into system space.
                           ^^^^^^^^^^^^^指什么

direct_io方法时,先把app的地址lock,保证他在物理内存,但是在2G上面的driver还是不能直接去用他,要在system空间(2G上面)建立他的映射,通过这个映射来访问app的被lock的内存。mdl就是描述这个的东东。我向ds的这个函数应该是干这个活的。

KMemory::MapToUserSpace
PVOID MapToUserSpace(void);

Map the memory region into the address space of the current process.

和上面的空间有什么区别呢???


就是当前的进程的空间啊,看他的字面,应该是说app进程。大概这样做了,app也可以访问那个share的memory了吧。没有详细看。 :D
rifter
论坛版主
论坛版主
  • 注册日期2002-03-20
  • 最后登录2006-02-28
  • 粉丝1
  • 关注0
  • 积分65分
  • 威望8点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-08-15 13:01
[quote]ds中的文档:
问几个问题,和ds无关

KMemory::MapToSystemSpace
PVOID MapToSystemSpace(void);

Map the memory region into system space.
                           ^^^^^^^^^^^^^指什么

direct_io方法时,先把app的地址lock,保证他在物理内存,但是在2G上面的driver还是不能直接去用他,要在system空间(2G上面)建立他的映射,通过这个映射来访问app的被lock的内存。mdl就是描述这个的东东。我向ds的这个函数应该是干这个活的。

KMemory::MapToUserSpace
PVOID MapToUserSpace(void);

Map the memory region into the address space of the current process.

和上面的空间有什么区别呢???


就是当前的进程的空间啊,看他的字面,应该是说app进程。大概这样做了,app也可以访问那个share的memory了吧。没有详细看。 :D

[/quote]


给我程序加进了Lock 、unlock功能,错误似乎还存在
5555
要死了 :(
分数 你想要吗?
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
地板#
发布于:2002-08-15 13:41
不需要你去lock、unlock啊,IO管理器会做事情的啊。〕
这是系统做的。
direct_io方法时,先把app的地址lock,保证他在物理内存,但是在2G上面的driver还是不能直接去用他,要在system空间(2G上面)建立他的映射,通过这个映射来访问app的被lock的内存。
rifter
论坛版主
论坛版主
  • 注册日期2002-03-20
  • 最后登录2006-02-28
  • 粉丝1
  • 关注0
  • 积分65分
  • 威望8点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-08-15 14:12
不需要你去lock、unlock啊,IO管理器会做事情的啊。〕
这是系统做的。
direct_io方法时,先把app的地址lock,保证他在物理内存,但是在2G上面的driver还是不能直接去用他,要在system空间(2G上面)建立他的映射,通过这个映射来访问app的被lock的内存。


现在又出 DRIVER_IRQL_NOT_OR_EQUAL 错误啦
位置还不一样,真要命。帮助我看看,怎么计算出错的位置的帖子
分数 你想要吗?
游客

返回顶部