mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 00:25:41 +00:00
Fixed problem with dpc execution
svn path=/trunk/; revision=552
This commit is contained in:
parent
5b3ccbfc02
commit
d913de5c14
3 changed files with 23 additions and 15 deletions
|
@ -23,6 +23,8 @@
|
||||||
*/
|
*/
|
||||||
static KIRQL CurrentIrql = HIGH_LEVEL;
|
static KIRQL CurrentIrql = HIGH_LEVEL;
|
||||||
|
|
||||||
|
extern ULONG DpcQueueSize;
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -45,7 +47,7 @@ static unsigned int HiSetCurrentPICMask(unsigned int mask)
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HiSwitchIrql(void)
|
static VOID HiSwitchIrql(KIRQL oldIrql)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Switches to the current irql
|
* FUNCTION: Switches to the current irql
|
||||||
* NOTE: Must be called with interrupt disabled
|
* NOTE: Must be called with interrupt disabled
|
||||||
|
@ -59,7 +61,6 @@ static void HiSwitchIrql(void)
|
||||||
if (CurrentIrql == HIGH_LEVEL)
|
if (CurrentIrql == HIGH_LEVEL)
|
||||||
{
|
{
|
||||||
HiSetCurrentPICMask(0xffff);
|
HiSetCurrentPICMask(0xffff);
|
||||||
// if (CurrentThread != NULL) CurrentThread->KernelApcDisable = TRUE;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CurrentIrql > DISPATCH_LEVEL)
|
if (CurrentIrql > DISPATCH_LEVEL)
|
||||||
|
@ -72,27 +73,32 @@ static void HiSwitchIrql(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
HiSetCurrentPICMask(current_mask);
|
HiSetCurrentPICMask(current_mask);
|
||||||
// if (CurrentThread != NULL) CurrentThread->KernelApcDisable = TRUE;
|
|
||||||
__asm__("sti\n\t");
|
__asm__("sti\n\t");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentIrql == DISPATCH_LEVEL)
|
if (CurrentIrql == DISPATCH_LEVEL)
|
||||||
{
|
{
|
||||||
// if (CurrentThread != NULL) CurrentThread->KernelApcDisable = TRUE;
|
|
||||||
HiSetCurrentPICMask(0);
|
HiSetCurrentPICMask(0);
|
||||||
__asm__("sti\n\t");
|
__asm__("sti\n\t");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CurrentIrql == APC_LEVEL)
|
if (CurrentIrql == APC_LEVEL)
|
||||||
{
|
{
|
||||||
// if (CurrentThread != NULL) CurrentThread->KernelApcDisable = TRUE;
|
|
||||||
HiSetCurrentPICMask(0);
|
HiSetCurrentPICMask(0);
|
||||||
__asm__("sti\n\t");
|
__asm__("sti\n\t");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (CurrentThread != NULL) CurrentThread->KernelApcDisable = FALSE;
|
|
||||||
HiSetCurrentPICMask(0);
|
HiSetCurrentPICMask(0);
|
||||||
|
if (DpcQueueSize > 0 && oldIrql >= DISPATCH_LEVEL)
|
||||||
|
{
|
||||||
|
KeSetCurrentIrql(DISPATCH_LEVEL);
|
||||||
|
__asm__("sti\n\t");
|
||||||
|
KeDrainDpcQueue();
|
||||||
|
__asm__("cli\n\t");
|
||||||
|
KeSetCurrentIrql(PASSIVE_LEVEL);
|
||||||
|
}
|
||||||
__asm__("sti\n\t");
|
__asm__("sti\n\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,17 +127,21 @@ VOID KeLowerIrql(KIRQL NewIrql)
|
||||||
* NewIrql = Irql to lower to
|
* NewIrql = Irql to lower to
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
KIRQL oldIrql;
|
||||||
|
|
||||||
__asm__("cli\n\t");
|
__asm__("cli\n\t");
|
||||||
|
|
||||||
DPRINT("NewIrql %x CurrentIrql %x\n",NewIrql,CurrentIrql);
|
DPRINT("NewIrql %x CurrentIrql %x\n",NewIrql,CurrentIrql);
|
||||||
if (NewIrql > CurrentIrql)
|
if (NewIrql > CurrentIrql)
|
||||||
{
|
{
|
||||||
DbgPrint("NewIrql %x CurrentIrql %x\n",NewIrql,CurrentIrql);
|
DbgPrint("(%s:%d) NewIrql %x CurrentIrql %x\n",
|
||||||
|
__FILE__, __LINE__, NewIrql,CurrentIrql);
|
||||||
KeDumpStackFrames(0,32);
|
KeDumpStackFrames(0,32);
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
oldIrql = CurrentIrql;
|
||||||
CurrentIrql = NewIrql;
|
CurrentIrql = NewIrql;
|
||||||
HiSwitchIrql();
|
HiSwitchIrql(oldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
|
VOID KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
|
||||||
|
@ -161,7 +171,7 @@ VOID KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
|
||||||
// *OldIrql = InterlockedExchange(&CurrentIrql,NewIrql);
|
// *OldIrql = InterlockedExchange(&CurrentIrql,NewIrql);
|
||||||
DPRINT("NewIrql %x OldIrql %x CurrentIrql %x\n",NewIrql,*OldIrql,
|
DPRINT("NewIrql %x OldIrql %x CurrentIrql %x\n",NewIrql,*OldIrql,
|
||||||
CurrentIrql);
|
CurrentIrql);
|
||||||
HiSwitchIrql();
|
HiSwitchIrql(*OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ void KeDrainDpcQueue(void)
|
||||||
PKDPC current;
|
PKDPC current;
|
||||||
KIRQL oldlvl;
|
KIRQL oldlvl;
|
||||||
|
|
||||||
|
assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
||||||
|
|
||||||
if (DpcQueueSize == 0)
|
if (DpcQueueSize == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -158,13 +158,13 @@ VOID PsDispatchThread(VOID)
|
||||||
KIRQL irql;
|
KIRQL irql;
|
||||||
LARGE_INTEGER TickCount;
|
LARGE_INTEGER TickCount;
|
||||||
|
|
||||||
KeAcquireSpinLock(&ThreadListLock,&irql);
|
|
||||||
|
|
||||||
if (!DoneInitYet)
|
if (!DoneInitYet)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&ThreadListLock, &irql);
|
||||||
|
|
||||||
DPRINT("PsDispatchThread() Current %x\n",CurrentThread);
|
DPRINT("PsDispatchThread() Current %x\n",CurrentThread);
|
||||||
|
|
||||||
if (CurrentThread->Tcb.State==THREAD_STATE_RUNNING)
|
if (CurrentThread->Tcb.State==THREAD_STATE_RUNNING)
|
||||||
|
@ -180,10 +180,6 @@ VOID PsDispatchThread(VOID)
|
||||||
if (Candidate == CurrentThread)
|
if (Candidate == CurrentThread)
|
||||||
{
|
{
|
||||||
DPRINT("Scheduling current thread\n");
|
DPRINT("Scheduling current thread\n");
|
||||||
if (PiNrRunnableThreads > 2)
|
|
||||||
{
|
|
||||||
DbgPrint(".");
|
|
||||||
}
|
|
||||||
KeQueryTickCount(&TickCount);
|
KeQueryTickCount(&TickCount);
|
||||||
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||||
CurrentThread->Tcb.State = THREAD_STATE_RUNNING;
|
CurrentThread->Tcb.State = THREAD_STATE_RUNNING;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue