Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: "Don Burn" <burn@xxxxxxxxxxxxxxxx>
- Date: Thu, 7 Sep 2006 10:50:09 -0400
Sorry, it was early the instance I was thinking of was
KeAcquireSpinLockAtDpc. This code was done by a very good developer who is
now a respected member of the Windows driver community (and not me).
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
<soviet_bloke@xxxxxxxxxxx> wrote in message
news:1157640287.046142.16480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Don
For instance, if you forget that a routine uses
spinlocks and then accidently call it from your ISR, it may very well
work
on an SMP system because the spinlock is an actual test and set, but it
has
terrible consequences on a UP system where it becomes a NOP since the
IRQL
is above DISPATCH_LEVEL.
Trying to call the routine that uses spinlocks from ISR is not going to
work fine on
MP system either. Let's look at how MP HAL obtains spinlocks - the code
below is implementation of KeAcquireSpinLock() from halmacpi.dll
80012830: mov edx,dword ptr ds:[FFFE0080h]
80012836: mov dword ptr ds:[FFFE0080h],41h
80012840: shr edx,4
80012843: movzx eax,byte ptr [edx+8001D218h]
8001284A: lock bts dword ptr [ecx],0
8001284F: jb 80012854
80012851: ret
As you can see, the very first step KeAcquireSpinLock() does is
UNCONDITIONALLY(!!!)writing 0x41 to the Task Priority Register, i.e.
setting IRQL to DISPATCH_LEVEL, and then proceeds to set and test.
KeAcquireQueuedSpinLock() behaves in similar fashion. Therefore,
calling these functions at IRQL>DISPATCH_LEVEL is quite unwise thing to
do - even on MP HAL.
Anton Bassov
Don Burn wrote:
<soviet_bloke@xxxxxxxxxxx> wrote in message
Well, you can think of my examples as of ones of the bugs if you wish -Yes they are doing something you are not supposed to do, that is a pretty
no matter how you call them, these are the examples of doing something
you are not supposed to do, which may have undesirable effects (unless
you are 100% sure you know what you are doing)
good definition of a bug. For instance, if you forget that a routine
uses
spinlocks and then accidently call it from your ISR, it may very well
work
on an SMP system because the spinlock is an actual test and set, but it
has
terrible consequences on a UP system where it becomes a NOP since the
IRQL
is above DISPATCH_LEVEL.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
.
- Follow-Ups:
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: soviet_bloke
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- References:
- WinXPSP2, Intel Core2Duo, Kernel drivers
- From: on3lonestar
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: Don Burn
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: soviet_bloke
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: Calvin Guan
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: soviet_bloke
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: Calvin Guan
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: soviet_bloke
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: Don Burn
- Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- From: soviet_bloke
- WinXPSP2, Intel Core2Duo, Kernel drivers
- Prev by Date: Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- Next by Date: Re: SetupDiCallClassInstaller on Vista
- Previous by thread: Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- Next by thread: Re: WinXPSP2, Intel Core2Duo, Kernel drivers
- Index(es):
Relevant Pages
|
Loading