Windows DDK 示例如何处理页面调出?我在示例中没有看到太多处理它的代码
为什么 Windows DDK 示例不处理页面调出?它们是不可分页的吗?
How come the Windows DDK samples do not deal with being paged out? Are they non-pageable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可分页代码用#pragma code_seg("PAGE") 标记。这就是驱动程序不处理寻呼的原因。默认情况下,它们都是不可分页的。
Pageable code is marked with #pragma code_seg("PAGE"). That's why the drivers are not dealing with paging. They are by default all non-pagable.
不是专门针对 Windows 驱动程序,而是针对一般设备驱动程序:
不要使用大型驱动程序。
不要在内核模式下做那么多工作,当然也不要在高中断优先级下做那么多工作。仅执行这些级别需要的操作,然后将其余工作委托给在最低级别 (0) 运行的代码。
Not speaking specifically of Windows drivers, but only for device drivers in general:
Don't have large drivers.
Don't do that much work in kernel mode and certainly don't do that much work at high interrupt priority levels. Do only what's needed at these levels, then delegate the rest of the work to code that runs at the lowest level (0).
分页代码由
#pragma code_seg("PAGExxx")
包装,分页数据由#pragma data_seg("PAGExxx")
包装。还可以使用#pragma alloc_text 指定分页函数(仅限 c 链接)。从 WDK 8 开始,还可以使用declspec(allocate())
对类进行分页。还有一个 API 可以锁定和解锁内存中的页面,从而允许运行时控制。在此处查看更多信息:http://social.msdn.microsoft.com/Forums/en-US/wdk/thread/ba75e766-6a8f-4fe8-9d03-b69be85655d9Paged code is wrapped by
#pragma code_seg("PAGExxx")
, paged data by#pragma data_seg("PAGExxx")
. It's also possible to specify paged functions (only c-linkage) with#pragma alloc_text
. Classes can also be paged by usingdeclspec(allocate())
starting with WDK 8. There is also an API to lock and unlock pages in memory, allowing runtime control. See more here: http://social.msdn.microsoft.com/Forums/en-US/wdk/thread/ba75e766-6a8f-4fe8-9d03-b69be85655d9