mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:36:11 +00:00
- We now implement the KeUpdateSystemTime routine and the HalpClockInterrupt.
- We do not yet handle all cases, most notably, timer expiration. - There may still be some bugs to work out in the code, but it's a start. - This regresses progress, but does not ignore time anymore. svn path=/trunk/; revision=34084
This commit is contained in:
parent
82cbbc6ac9
commit
d7928010a4
2 changed files with 140 additions and 9 deletions
|
@ -16,7 +16,6 @@
|
||||||
#undef ExReleaseFastMutex
|
#undef ExReleaseFastMutex
|
||||||
#undef ExTryToAcquireFastMutex
|
#undef ExTryToAcquireFastMutex
|
||||||
#undef KeAcquireSpinLock
|
#undef KeAcquireSpinLock
|
||||||
#undef KeGetCurrentIrql
|
|
||||||
#undef KeLowerIrql
|
#undef KeLowerIrql
|
||||||
#undef KeRaiseIrql
|
#undef KeRaiseIrql
|
||||||
#undef KeReleaseSpinLock
|
#undef KeReleaseSpinLock
|
||||||
|
@ -26,6 +25,7 @@
|
||||||
|
|
||||||
/* DATA **********************************************************************/
|
/* DATA **********************************************************************/
|
||||||
|
|
||||||
|
ULONG HalpCurrentTimeIncrement, HalpNextTimeIncrement, HalpNextIntervalCount;
|
||||||
ULONG _KdComPortInUse = 0;
|
ULONG _KdComPortInUse = 0;
|
||||||
|
|
||||||
ULONG HalpIrqlTable[HIGH_LEVEL + 1] =
|
ULONG HalpIrqlTable[HIGH_LEVEL + 1] =
|
||||||
|
@ -471,9 +471,25 @@ HalpClockInterrupt(VOID)
|
||||||
//
|
//
|
||||||
// Clear the interrupt
|
// Clear the interrupt
|
||||||
//
|
//
|
||||||
//DPRINT1("CLOCK INTERRUPT!!!\n");
|
ASSERT(KeGetCurrentIrql() == CLOCK2_LEVEL);
|
||||||
WRITE_REGISTER_ULONG(TIMER0_INT_CLEAR, 1);
|
WRITE_REGISTER_ULONG(TIMER0_INT_CLEAR, 1);
|
||||||
//while (TRUE);
|
|
||||||
|
//
|
||||||
|
// FIXME: Update HAL Perf counters
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIXME: Check if someone changed the clockrate
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call the kernel
|
||||||
|
//
|
||||||
|
KeUpdateSystemTime(NULL, CLOCK2_LEVEL, HalpCurrentTimeIncrement);
|
||||||
|
|
||||||
|
//
|
||||||
|
// We're done
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -527,9 +543,6 @@ HalpInitializeInterrupts(VOID)
|
||||||
WRITE_REGISTER_ULONG(TIMER0_CONTROL, ControlRegister.AsUlong);
|
WRITE_REGISTER_ULONG(TIMER0_CONTROL, ControlRegister.AsUlong);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG HalpCurrentTimeIncrement, HalpNextTimeIncrement, HalpNextIntervalCount;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -1345,6 +1358,7 @@ HalSweepIcache(VOID)
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
#undef KeGetCurrentIrql
|
||||||
KIRQL
|
KIRQL
|
||||||
NTAPI
|
NTAPI
|
||||||
KeGetCurrentIrql(VOID)
|
KeGetCurrentIrql(VOID)
|
||||||
|
|
|
@ -10,6 +10,10 @@ ULONG KeProcessorLevel;
|
||||||
ULONG KeProcessorRevision;
|
ULONG KeProcessorRevision;
|
||||||
ULONG KeFeatureBits;
|
ULONG KeFeatureBits;
|
||||||
|
|
||||||
|
|
||||||
|
extern LONG KiTickOffset;
|
||||||
|
extern ULONG KeTimeAdjustment;
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
KiComputeTimerTableIndex(IN LONGLONG DueTime)
|
KiComputeTimerTableIndex(IN LONGLONG DueTime)
|
||||||
{
|
{
|
||||||
|
@ -32,8 +36,121 @@ KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
|
||||||
IN KIRQL Irql,
|
IN KIRQL Irql,
|
||||||
IN ULONG Increment)
|
IN ULONG Increment)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
PKPRCB Prcb = KeGetPcr()->Prcb;
|
||||||
while (TRUE);
|
LARGE_INTEGER SystemTime, InterruptTime;
|
||||||
|
ULONG Hand;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do nothing if this tick is being skipped
|
||||||
|
//
|
||||||
|
if (Prcb->SkipTick)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handle it next time
|
||||||
|
//
|
||||||
|
Prcb->SkipTick = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add the increment time to the shared data
|
||||||
|
//
|
||||||
|
InterruptTime.HighPart = SharedUserData->InterruptTime.High1Time;
|
||||||
|
InterruptTime.LowPart = SharedUserData->InterruptTime.LowPart;
|
||||||
|
InterruptTime.QuadPart += Increment;
|
||||||
|
SharedUserData->InterruptTime.High1Time = InterruptTime.HighPart;
|
||||||
|
SharedUserData->InterruptTime.LowPart = InterruptTime.LowPart;
|
||||||
|
SharedUserData->InterruptTime.High2Time = InterruptTime.HighPart;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update tick count
|
||||||
|
//
|
||||||
|
KiTickOffset -= Increment;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for incomplete tick
|
||||||
|
//
|
||||||
|
if (KiTickOffset > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update the system time
|
||||||
|
//
|
||||||
|
SystemTime.HighPart = SharedUserData->SystemTime.High1Time;
|
||||||
|
SystemTime.LowPart = SharedUserData->SystemTime.LowPart;
|
||||||
|
SystemTime.QuadPart += KeTimeAdjustment;
|
||||||
|
SharedUserData->SystemTime.High1Time = SystemTime.HighPart;
|
||||||
|
SharedUserData->SystemTime.LowPart = SystemTime.LowPart;
|
||||||
|
SharedUserData->SystemTime.High2Time = SystemTime.HighPart;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update the tick count
|
||||||
|
//
|
||||||
|
SystemTime.HighPart = KeTickCount.High1Time;
|
||||||
|
SystemTime.LowPart = KeTickCount.LowPart;
|
||||||
|
SystemTime.QuadPart += 1;
|
||||||
|
KeTickCount.High1Time = SystemTime.HighPart;
|
||||||
|
KeTickCount.LowPart = SystemTime.LowPart;
|
||||||
|
KeTickCount.High2Time = SystemTime.HighPart;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update it in the shared user data
|
||||||
|
//
|
||||||
|
SharedUserData->TickCount.High1Time = SystemTime.HighPart;
|
||||||
|
SharedUserData->TickCount.LowPart = SystemTime.LowPart;
|
||||||
|
SharedUserData->TickCount.High2Time = SystemTime.HighPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for timer expiration
|
||||||
|
//
|
||||||
|
Hand = KeTickCount.LowPart & (TIMER_TABLE_SIZE - 1);
|
||||||
|
Hand <<= 4;
|
||||||
|
if (KiTimerTableListHead[Hand].Time.QuadPart > InterruptTime.QuadPart)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Timer has expired!
|
||||||
|
//
|
||||||
|
DPRINT1("TIMER EXPIRATION!!!\n");
|
||||||
|
while (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if we should request a debugger break
|
||||||
|
//
|
||||||
|
if (KdDebuggerEnabled)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check if we should break
|
||||||
|
//
|
||||||
|
if (KdPollBreakIn()) DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if this was a full tick
|
||||||
|
//
|
||||||
|
if (KiTickOffset <= 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Updare the tick offset
|
||||||
|
//
|
||||||
|
KiTickOffset += KeMaximumIncrement;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update system runtime
|
||||||
|
//
|
||||||
|
KeUpdateRunTime(NULL, CLOCK2_LEVEL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Increase interrupt count and exit
|
||||||
|
//
|
||||||
|
Prcb->InterruptCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue