forked from xt-sys/exectos
Rework initial timer support
This commit is contained in:
parent
12ce7aae3f
commit
331c5bfeda
@ -24,6 +24,10 @@ XTFASTCALL
|
|||||||
VOID
|
VOID
|
||||||
KeAcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock);
|
KeAcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock);
|
||||||
|
|
||||||
|
XTAPI
|
||||||
|
BOOLEAN
|
||||||
|
KeCancelTimer(IN PKTIMER Timer);
|
||||||
|
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
KRUNLEVEL
|
KRUNLEVEL
|
||||||
KeGetCurrentRunLevel(VOID);
|
KeGetCurrentRunLevel(VOID);
|
||||||
@ -63,11 +67,7 @@ KeInitializeThreadedDpc(IN PKDPC Dpc,
|
|||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeTimer(OUT PKTIMER Timer);
|
KeInitializeTimer(OUT PKTIMER Timer,
|
||||||
|
|
||||||
XTAPI
|
|
||||||
VOID
|
|
||||||
KeInitializeTimerEx(OUT PKTIMER Timer,
|
|
||||||
IN KTIMER_TYPE Type);
|
IN KTIMER_TYPE Type);
|
||||||
|
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
|
@ -17,6 +17,10 @@ XTAPI
|
|||||||
VOID
|
VOID
|
||||||
KeClearEvent(IN PKEVENT Event);
|
KeClearEvent(IN PKEVENT Event);
|
||||||
|
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
KeClearTimer(IN PKTIMER Timer);
|
||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeHaltSystem(VOID);
|
KeHaltSystem(VOID);
|
||||||
@ -78,6 +82,14 @@ XTAPI
|
|||||||
VOID
|
VOID
|
||||||
KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters);
|
KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters);
|
||||||
|
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
KepExitDispatcher(IN KRUNLEVEL OldRunLevel);
|
||||||
|
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
KepRemoveTimer(IN OUT PKTIMER Timer);
|
||||||
|
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KepRetireDpcList(IN PKPROCESSOR_CONTROL_BLOCK Prcb);
|
KepRetireDpcList(IN PKPROCESSOR_CONTROL_BLOCK Prcb);
|
||||||
|
@ -113,7 +113,7 @@ KeInitializeThread(IN PKPROCESS Process,
|
|||||||
KeInitializeSemaphore(&Thread->SuspendSemaphore, 0, 2);
|
KeInitializeSemaphore(&Thread->SuspendSemaphore, 0, 2);
|
||||||
|
|
||||||
/* Initialize the builtin timer */
|
/* Initialize the builtin timer */
|
||||||
KeInitializeTimer(&Thread->Timer);
|
KeInitializeTimer(&Thread->Timer, NotificationTimer);
|
||||||
TimerWaitBlock = &Thread->WaitBlock[KTIMER_WAIT_BLOCK];
|
TimerWaitBlock = &Thread->WaitBlock[KTIMER_WAIT_BLOCK];
|
||||||
TimerWaitBlock->Object = &Thread->Timer;
|
TimerWaitBlock->Object = &Thread->Timer;
|
||||||
TimerWaitBlock->WaitKey = STATUS_TIMEOUT;
|
TimerWaitBlock->WaitKey = STATUS_TIMEOUT;
|
||||||
@ -194,6 +194,26 @@ KeStartThread(IN PKTHREAD Thread)
|
|||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the dispatcher, switches context to a new thread and lowers runlevel to its original state.
|
||||||
|
*
|
||||||
|
* @param OldRunLevel
|
||||||
|
* Supplies the original runlevel state.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
VOID
|
||||||
|
KepExitDispatcher(IN KRUNLEVEL OldRunLevel)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
|
/* Lower runlevel */
|
||||||
|
KeLowerRunLevel(OldRunLevel);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspend APC-built thread NOP routine. It takes no actions.
|
* Suspend APC-built thread NOP routine. It takes no actions.
|
||||||
*
|
*
|
||||||
|
@ -10,21 +10,61 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a kernel timer.
|
* Cancels the timer.
|
||||||
*
|
*
|
||||||
* @param Timer
|
* @param Timer
|
||||||
* Supplies a pointer to a time object.
|
* Supplies a pointer to a timer object.
|
||||||
*
|
*
|
||||||
* @return This routine does not return any value.
|
* @return This routine returns TRUE if the cancelled timer was set, or FALSE otherwise.
|
||||||
*
|
*
|
||||||
* @since NT 3.5
|
* @since NT 3.5
|
||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
BOOLEAN
|
||||||
KeInitializeTimer(OUT PKTIMER Timer)
|
KeCancelTimer(IN PKTIMER Timer)
|
||||||
{
|
{
|
||||||
/* Initialize the timer */
|
BOOLEAN Result;
|
||||||
KeInitializeTimerEx(Timer, NotificationTimer);
|
KRUNLEVEL OldRunLevel;
|
||||||
|
|
||||||
|
/* Set default result value */
|
||||||
|
Result = FALSE;
|
||||||
|
|
||||||
|
/* Raise run level and acquire dispatcher lock */
|
||||||
|
OldRunLevel = KeRaiseRunLevel(SYNC_LEVEL);
|
||||||
|
KeAcquireQueuedSpinLock(DispatcherLock);
|
||||||
|
|
||||||
|
/* Check timer status */
|
||||||
|
if(Timer->Header.Inserted)
|
||||||
|
{
|
||||||
|
/* Remove the timer from the list */
|
||||||
|
KepRemoveTimer(Timer);
|
||||||
|
Result = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release dispatcher lock and processes the deferred ready list */
|
||||||
|
KeReleaseQueuedSpinLock(DispatcherLock);
|
||||||
|
KepExitDispatcher(OldRunLevel);
|
||||||
|
|
||||||
|
/* Return result */
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the signal state of the timer.
|
||||||
|
*
|
||||||
|
* @param Timer
|
||||||
|
* Supplies a pointer to a timer object.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since NT 4.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
KeClearTimer(IN PKTIMER Timer)
|
||||||
|
{
|
||||||
|
/* Clear signal state */
|
||||||
|
Timer->Header.SignalState = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,11 +78,11 @@ KeInitializeTimer(OUT PKTIMER Timer)
|
|||||||
*
|
*
|
||||||
* @return This routine does not return any value.
|
* @return This routine does not return any value.
|
||||||
*
|
*
|
||||||
* @since NT 3.5
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KeInitializeTimerEx(OUT PKTIMER Timer,
|
KeInitializeTimer(OUT PKTIMER Timer,
|
||||||
IN KTIMER_TYPE Type)
|
IN KTIMER_TYPE Type)
|
||||||
{
|
{
|
||||||
/* Initialize the header */
|
/* Initialize the header */
|
||||||
@ -58,3 +98,22 @@ KeInitializeTimerEx(OUT PKTIMER Timer,
|
|||||||
RtlInitializeListHead(&Timer->Header.WaitListHead);
|
RtlInitializeListHead(&Timer->Header.WaitListHead);
|
||||||
RtlInitializeListHead(&Timer->TimerListEntry);
|
RtlInitializeListHead(&Timer->TimerListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a specified timer from the timer list.
|
||||||
|
*
|
||||||
|
* @param Timer
|
||||||
|
* Supplies a pointer to a timer object.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
KepRemoveTimer(IN OUT PKTIMER Timer)
|
||||||
|
{
|
||||||
|
/* Remove the timer from the list */
|
||||||
|
Timer->Header.Inserted = FALSE;
|
||||||
|
RtlRemoveEntryList(&Timer->TimerListEntry);
|
||||||
|
}
|
||||||
|
@ -34,7 +34,7 @@ PoInitializeProcessorControlBlock(IN OUT PKPROCESSOR_CONTROL_BLOCK Prcb)
|
|||||||
/* Initialize DPC and Timer */
|
/* Initialize DPC and Timer */
|
||||||
KeInitializeDpc(&Prcb->PowerState.PerfDpc, PopPerfIdleDpc, Prcb);
|
KeInitializeDpc(&Prcb->PowerState.PerfDpc, PopPerfIdleDpc, Prcb);
|
||||||
KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
|
KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
|
||||||
KeInitializeTimerEx(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
|
KeInitializeTimer(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,14 +13,14 @@
|
|||||||
@ cdecl HlIoPortOutShort(ptr long)
|
@ cdecl HlIoPortOutShort(ptr long)
|
||||||
@ fastcall KeAcquireQueuedSpinLock(long)
|
@ fastcall KeAcquireQueuedSpinLock(long)
|
||||||
@ fastcall KeAcquireSpinLock(ptr)
|
@ fastcall KeAcquireSpinLock(ptr)
|
||||||
|
@ stdcall KeCancelTimer(ptr)
|
||||||
@ fastcall KeGetCurrentRunLevel()
|
@ fastcall KeGetCurrentRunLevel()
|
||||||
@ stdcall KeInitializeApc(ptr ptr long ptr ptr ptr long ptr)
|
@ stdcall KeInitializeApc(ptr ptr long ptr ptr ptr long ptr)
|
||||||
@ stdcall KeInitializeDpc(ptr ptr ptr)
|
@ stdcall KeInitializeDpc(ptr ptr ptr)
|
||||||
@ stdcall KeInitializeSemaphore(ptr long long)
|
@ stdcall KeInitializeSemaphore(ptr long long)
|
||||||
@ stdcall KeInitializeSpinLock(ptr)
|
@ stdcall KeInitializeSpinLock(ptr)
|
||||||
@ stdcall KeInitializeThreadedDpc(ptr ptr ptr)
|
@ stdcall KeInitializeThreadedDpc(ptr ptr ptr)
|
||||||
@ stdcall KeInitializeTimer(ptr)
|
@ stdcall KeInitializeTimer(ptr long)
|
||||||
@ stdcall KeInitializeTimerEx(ptr long)
|
|
||||||
@ fastcall KeLowerRunLevel(long)
|
@ fastcall KeLowerRunLevel(long)
|
||||||
@ fastcall KeRaiseRunLevel(long)
|
@ fastcall KeRaiseRunLevel(long)
|
||||||
@ stdcall KeReadSemaphoreState(ptr)
|
@ stdcall KeReadSemaphoreState(ptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user