阅读:1783回复:5
DDK的DriverEntry和AddDevice 运行在什么IRQL上?
我想创建一块非分页的内存,可是资料上讲分配内存时要运行在DISPATCH_LEVEL_IRQL上,我不知道可不可以在DriverEntry或AddDevice中创建非分页内存?
|
|
|
沙发#
发布于:2002-06-26 16:29
哪本资料上讲的?
这是最权威的DDK文档中的内容: Callers of ExAllocatePool must be running at IRQL <= DISPATCH_LEVEL. A caller at DISPATCH_LEVEL must specify a NonPagedXxx PoolType. Otherwise, the caller must be running at IRQL < DISPATCH_LEVEL. DriverEntry在哪个IRQL上,不太清楚,应该在DISPATCH_LEVEL ,而AddDevice是在DISPATCH_LEVEL 上的。可以是可以的,不过为什么在这两个例程中分配非分页的呢?至少在DriverEntry中没有必要吧 |
|
板凳#
发布于:2002-06-26 16:44
谢谢blue的指点,我是看到 Windows 2000 设备驱动程序设计指南 上讲的,我想在Isr中从工控卡读数据到缓冲区,外部数据的到达产生中断,然后在Isr中读数据到缓冲区,那么在哪个例程里为缓冲区分配内存比较好呢?在StartIO?太晚了吧。
|
|
|
地板#
发布于:2002-06-26 16:54
AddDevice中分配,RemoveDevice中释放。
|
|
|
地下室#
发布于:2002-06-26 17:03
呵呵!driverentry好象是PASSIVE级的
Every DriverEntry routine is run in the context of a system thread at IRQL PASSIVE_LEVEL. Therefore, any memory allocated with ExAllocatePool for use exclusively during initialization can be from paged pool, as long as the driver does not control the device that holds the system page file. The allocated memory must be released with ExFreePool before DriverEntry returns control. However, a driver that sets a Reinitialize routine can pass a pointer to this memory when it calls IoRegisterDriverReinitialization, thus making the driver\'s Reinitialize routine responsible for freeing the memory allocation. An AddDevice routine is called in the context of a system thread at IRQL PASSIVE_LEVEL |
|
5楼#
发布于:2002-06-27 08:50
谢谢各位老鸟对小鸟的爱护,给分了给分了
|
|
|