阅读:1072回复:3
求教:EPP驱动程序在超线程计算机上出现死机!
我的EPP驱动程序,原来在不含超线程计算机上运行正常,换到超线程计算机上出现死机(非蓝屏),且时机不定,无法进行跟踪调试。
希望大侠们赐教! |
|
沙发#
发布于:2004-04-27 22:07
建议在所有访问共享资源的地方,全部用自旋锁保护,考虑有可能HT CPU上还是使用单CPU的NTOSKRNL,所以有必要的话自己实现保护
|
|
|
板凳#
发布于:2004-04-28 08:16
感谢wowocock答复!
自旋锁保护应该已加了一些,单CPU的NTOSKRNL不知如何才能看出来 如果自己实现保护该怎么做? |
|
地板#
发布于:2004-04-28 13:18
参考2K的代码
;++ ; ; LOGICAL ; KiTryToAcquireQueuedSpinLock ( ; IN KSPIN_LOCK_QUQUE_NUMBER Number ; IN PKSPIN_LOCK_QUEUE QueuedLock ; ) ; ; Routine Description: ; ; This function attempts to acquire the specified queued spinlock. ; No change to IRQL is made, IRQL is not returned. It is ; expected IRQL is sufficient to avoid context switch. ; ; NOTE: This code may be modified for use during textmode ; setup if this is an MP kernel running with a UP HAL. ; ; Arguments: ; ; LockQueueEntry (ecx) - Supplies the address of the queued ; spinlock intry in this processor\'s ; PRCB. ; ; Return Value: ; ; TRUE if the lock was acquired, FALSE otherwise. ; N.B. ZF is set if FALSE returned, clear otherwise. ; ;-- align 16 cPublicFastCall KiTryToAcquireQueuedSpinLock,1 cPublicFpo 0,0 ifndef NT_UP ; Get address of Lock Queue entry mov edx, [ecx].LqLock ; Store the Lock Queue entry address in the lock ONLY if the ; current lock value is 0. xor eax, eax ; old value must be 0 lock cmpxchg [edx], ecx jnz short taqsl60 ; Lock has been acquired. ; note: the actual lock address will be word aligned, we use ; the bottom two bits as indicators, bit 0 is LOCK_QUEUE_WAIT, ; bit 1 is LOCK_QUEUE_OWNER. or edx, LOCK_QUEUE_OWNER ; mark self as lock owner mov [ecx].LqLock, edx or eax, 1 ; return TRUE fstRET KiTryToAcquireQueuedSpinLock taqsl60: if DBG ; make sure it isn\'t already held by THIS processor. test edx, LOCK_QUEUE_OWNER jz short @f stdCall _KeBugCheckEx,<SPIN_LOCK_ALREADY_OWNED, edx, ecx,0,1> @@: endif ; The lock is already held by another processor. Indicate ; failure to the caller. xor eax, eax ; return FALSE fstRET KiTryToAcquireQueuedSpinLock ; In the event that this is an MP kernel running with a UP ; HAL, the following UP version is copied over the MP version ; during kernel initialization. public _KiTryToAcquireQueuedSpinLockUP _KiTryToAcquireQueuedSpinLockUP: endif ; UP version, always succeed. xor eax, eax or eax, 1 fstRet KiTryToAcquireQueuedSpinLock fstENDP KiTryToAcquireQueuedSpinLock |
|
|