阅读:1947回复:3
又是一个内存问题?
我们的网卡驱动程序遇到了一个小问题,网卡的接收是通过接收中断进入的,而且是
单包的,每次接收到包以后就向上indicate,我使用的是NdisMIndicateReceivePacket 函数,indicate几个包以后(有时候是十几到几十个包),跳出handleinterrupt函数 的时候,ndis将执行enableinterrupt函数, 当程序执行完enableinterrupt函数以后有时候就死机,每次死机都在这个地方,但并 不是每到这个地方就死机,有时候不死机,找了很长时间都不知道什么原因,请各位 大虾们帮忙。死机的时候用softice观察的是: Break due to Invalid Opcode Fault(06h) MSR LastExceptionFromIp=0000CCDD MSR LastExceptionToIp=00005249 有时候死机的时候出现的时一般保护性的错误。 |
|
最新喜欢:xiangs... |
板凳#
发布于:2001-08-31 14:04
下面就是我的程序:
在此之前我就已经把接受的数据从卡上读到了一个Adapter->RcvFrame上面了,请指教: NDIS_STATUS Status; // PNDIS_HANDLE PacketPoolHandle; UINT PacketNumber=10,BufferNumber=10,BufferCount,PacketLength,i; PNDIS_BUFFER FirstBuffer,HeaderBuffer,DataBuffer; PUCHAR HeaderBufferAddr,DataBufferAddr; // // Length of the packet // UINT DataLen; NdisAllocatePacketPool( &Status, &Adapter->RcvPacketPoolHandle, PacketNumber, 16 ); DbgPrint("Status=%x\n",Status); if(Status==NDIS_STATUS_SUCCESS) { DbgPrint("Allocate Packet Pool Success!!\n"); // return NDIS_STATUS_FAILURE; } NdisAllocateBufferPool( &Status, &Adapter->RcvBufferPoolHandle, BufferNumber ); DbgPrint("Status=%x\n",Status); if(Status!=NDIS_STATUS_SUCCESS) { return NDIS_STATUS_FAILURE; } NdisAllocatePacket( &Status, &Adapter->ReceivePacket, Adapter->RcvPacketPoolHandle ); DbgPrint("Status=%x\n",Status); if(Status!=NDIS_STATUS_SUCCESS) { return NDIS_STATUS_FAILURE; } NdisQueryPacket(Adapter->ReceivePacket,NULL,&BufferCount,NULL,&PacketLength); DbgPrint("BufferCount=%d PacketLength=%d\n",BufferCount,PacketLength); NDIS_SET_PACKET_HEADER_SIZE(Adapter->ReceivePacket,RN2001s_HEADER_SIZE); NdisAllocateBuffer( &Status, &HeaderBuffer, Adapter->RcvBufferPoolHandle, NULL,//HeaderBufferAddr, RN2001s_HEADER_SIZE ); if(Status!=NDIS_STATUS_SUCCESS) { return NDIS_STATUS_FAILURE; } NdisQueryBuffer(HeaderBuffer,(PVOID *)&HeaderBufferAddr,NULL); for(i=0;i<RN2001s_HEADER_SIZE;i++) { HeaderBufferAddr=Adapter->RcvFrame; } NdisChainBufferAtFront( Adapter->ReceivePacket, HeaderBuffer ); DataLen = Adapter->RcvFrame[12]*0x0100+Adapter->RcvFrame[13]; NdisAllocateBuffer( &Status, &DataBuffer, Adapter->RcvBufferPoolHandle, NULL,//DataBufferAddr, DataLen ); if(Status!=NDIS_STATUS_SUCCESS) { return NDIS_STATUS_FAILURE; } NdisQueryBuffer(HeaderBuffer,(PVOID *)&DataBufferAddr,NULL); for(i=0;i<DataLen;i++) { DataBufferAddr=Adapter->RcvFrame[i+RN2001s_HEADER_SIZE]; } NdisChainBufferAtBack( Adapter->ReceivePacket, DataBuffer ); NdisQueryPacket(Adapter->ReceivePacket,NULL,&BufferCount,NULL,&PacketLength); DbgPrint("BufferCount=%d PacketLength=%d\n",BufferCount,PacketLength); NdisMIndicateReceivePacket( Adapter->MiniportAdapterHandle, &Adapter->ReceivePacket, 1 ); NdisFreeBuffer(DataBuffer); NdisFreeBuffer(HeaderBuffer); NdisFreeBufferPool(Adapter->RcvBufferPoolHandle); NdisFreePacket(Adapter->ReceivePacket); NdisFreePacketPool(Adapter->RcvPacketPoolHandle); |
|
地板#
发布于:2001-08-31 14:43
好像应该为HeaderBufferAddr和DataBufferAddr分配内存
|
|
|