阅读:919回复:0
处理中断的VxD中出现页面错误!请大家帮忙!
我前两天在microsoft.public.development.device.drivers发了帖子询问,但是估计
老外们看了我写的英文没有几个活下来的。有一个坚强的还回了帖,真令人敬佩!下面 是我发的帖,估计咱中国人都看得懂, Hello all: I made a VxD to handle a interrupt from an ISA card. I made it by VToolsD. In interrupt handle, a page faule occured. Here it is: VOID XMyIRQ::OnHardwareInt(VMHANDLE hVM) { assert(hVM); Out_Debug_String(\"assert(hVM) OK!\\n\"); MyGlobalEvent* pEvent = new MyGlobalEvent(); Out_Debug_String(\"Create new event OK!\\n\"); if (pEvent) pEvent->schedule(); // <<--debug message:Break due to page fault(0Eh) //interrupt over pIRQ->sendPhysicalEOI(); // tell VPICD to clear the interrupt Out_Debug_String(\"VPICD_Phys_EOI(hIRQ) OK!\\n\"); } In SoftIce, I press continue, it will continue. And go in MyGlobalEvent::handler. Here it is: VOID MyGlobalEvent::handler(VMHANDLE hVM, CLIENT_STRUCT* pRegs, PVOID refData) { // whatever your handler does // (now safe to use any VMM service) Out_Debug_String(\"In Event handler,read CN1!\\n\"); UCHAR i; i=_inp(CN1); Out_Debug_Chr(i); // pIRQ->sendPhysicalEOI(); // tell VPICD to clear the interrupt // Out_Debug_String(\"VPICD_Phys_EOI(hIRQ) OK!\\n\"); Out_Debug_String(\"\\nInvoke the callback!\\n\"); _VWIN32_QueueUserApc(ring3func, (DWORD)i, TheThread); //<<--here ,a lot of page faults were shown, at last, it\'s hang. } I\'m a greenhand in this part. Please help me! 这个是老外的回帖: I\'m not quite sure if you can allocate memory (call new) in the interrupt handler. 我的疑问是:我完全按照VToolsD所提供的方法写的,这是VTooolsD提供的例程: VOID XEOC_IRQ::OnHardwareInt(VMHANDLE hVM) { //dprintf(\"DATAACQ: IRQ index %d\",dataindex); *pdatacursor = _inp(data_ac_base+0); pdatacursor++; dataindex++; // schedule a global event if (dataindex==buffersize) { EOC_GlobalEvent* pEvent = new EOC_GlobalEvent(); if (pEvent) { pEvent->schedule(); dataindex=0; pdatacursor=(PCHAR)pdatabase; } else { dataindex--; pdatacursor--; } } pEOC_IRQ->sendPhysicalEOI(); } 我不明白为什么我用的就是错的,它提供的例程是关于数据采集的,我没办法试。我写 的程式是按照它的说明文档写的,并且例程也与我写的相符,为什么一运行就会出错? 说明文档中介绍得很清楚,应该在GlobalEvent中调用服务,不能在中断服务中调用。 我几乎是把说明文档中的例程临摹下来的,可还是PageFault,请大虾指点!! 另外请问:在VxD处理中断的环境中,能否用APC的方式与Win32 App通讯?我在两个资料中看到两种答案,不知道该相信哪一种。请高手指点! 附件是VxD和应用程式主要的源文件 |
|
|