sojod
驱动牛犊
驱动牛犊
  • 注册日期2006-10-25
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分170分
  • 威望18点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
阅读:1172回复:1

请教页面换出的问题

楼主#
更多 发布于:2007-09-10 09:59
如下两个模块:
A.c
main()
{
……
}

B.c
int gVar = 0;
void func()
{
……
}

在main中先获得保护fVar的锁(ERESOURSE,IRQL提升到DPC),然后访问fVar偶尔会出现访问已换出页的错误。请问,变量gVar是分配在可换出页还是不可换出页里?
如果是在可换出页,这个问题应该如何解决?在NonPaged Pool中动态分配?还是使用其他的锁机制?
谢谢。
michaelgz
论坛版主
论坛版主
  • 注册日期2005-01-26
  • 最后登录2012-10-22
  • 粉丝1
  • 关注1
  • 积分150分
  • 威望1524点
  • 贡献值1点
  • 好评度213点
  • 原创分0分
  • 专家分2分
沙发#
发布于:2007-09-11 00:57
Don't quite understand your question. What you showed here is a typical user mode application, why you care about ERESOURCE and IRQL? Also ERESOURCE should be acquired at IRQL <= APC.

In kernel, MmProbeAndLockPages() can be called to make pageable memory resident and prevent it from paging out. Don't forget to call MmUnlockPages() after you done with it.
游客

返回顶部