Re: Disabling interrupts in Windows



what other process/thread/entity are you synchronizing against? as usb
device, you don't have access to any hardware, so the only code that i can
imagine which will look at the same buffer/pointer values is your own driver
code in some other part of the driver. If so, a simple spin lock is all you
need.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"ravi" <ravisrm@xxxxxxxxx> wrote in message
news:1137576133.257341.177750@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thanks for your replies. The way it functions is that the lower layer
> USB driver interrupts the Host PC and the OS schedules my DPC during
> the isr. In this DPC, there is a small piece of code where we do buffer
> and pointer updation and this piece of code should not be interrupted
> by any other task. So, therefore for a Very short duration I want to
> disable other tasks from interrupting my DPC and therefore want to
> disable all other interrupts since DPC priority is low.
> I used KeRaiseIrql(HIGH_LEVEL) and then restored back the Irql but this
> is causing the PC to restart when I run the driver on a Particular PC,
> on other PC's the code runs fine.
> Some Microsoft DDK guy recommended rasing Irql as a safe way of
> disabling interrupts from software.
> I am not sure whether its permitted to raise Irql to HIGH_LEVEL from
> DISPATCH_LEVEL.
>
> Is there a better way or any suggestions would be helpful.
>
> Gary G. Little wrote:
>> You can't do what you state you want to do, mostly because the OS will
>> not
>> let you. "cli/sti" at one time guaranteed uninteruptable code in such OSs
>> as
>> DOS, but from NT on and the advent of more usage of NMI as well as
>> multi-processor systems, the ability to produce totally non-interruptible
>> code is nearly impossible, unless you write your own HAL.
>>
>> The question then becomes what exactly are you trying to do that you
>> thought
>> setting and clearing the interrupt mask would solve your problem? Many of
>> us
>> here have dealt with some very hairy interrupt issues and found
>> solutions.
>> We just might be able to point you to a better way if we know the
>> details.
>>
>> --
>> The personal opinion of
>> Gary G. Litte
>>
>> "ravi" <ravisrm@xxxxxxxxx> wrote in message
>> news:1136971188.567762.10850@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> >I am executing a piece of code within a callback function for a USB
>> > driver which I want to protect from getting interrupted on a Pentium 4
>> > Hyperthreaded PC. I want to disable all other interrupts before this
>> > piece of code and then enable the interrupts when I am done. I used the
>> > assembly cli/sti for disabling the interrupts but this causes the PC to
>> > freeze when I run the USB driver with HYPERTHREADING enabled. With HT
>> > disabled the code runs fine.. So, I tried raising the Irql level to
>> > HIGH_LEVEL using the KeRaiseIrql function and then restoring the Irql
>> > to the old level using KeLowerIrql but it seems that some tasks DO
>> > interrupt my function. Is there any other way by which I can disable
>> > all other interrupts before my code??
>> > OS is WinXp/Win2000.
>> > - Thanks!!
>> >
>


.



Relevant Pages