mirror of
https://github.com/reactos/reactos.git
synced 2024-08-30 23:28:58 +00:00
- Update KeUpdateSystemTime to use variable increments.
- Update KeTickCount properly instead of an ugly timecast hack. - Also update UserSharedData->TickCount. - Get rid of KiRawTicks. - Properly update KiTickOffset at the end. svn path=/trunk/; revision=23679
This commit is contained in:
parent
8b82c0d641
commit
5e7ef1d665
|
@ -246,6 +246,16 @@ Author:
|
||||||
//
|
//
|
||||||
// KUSER_SHARED_DATA Offsets
|
// KUSER_SHARED_DATA Offsets
|
||||||
//
|
//
|
||||||
|
#ifdef __ASM__
|
||||||
|
#define USER_SHARED_DATA 0xFFDF0000
|
||||||
|
#endif
|
||||||
|
#define USER_SHARED_DATA_INTERRUPT_TIME 0x8
|
||||||
|
#define USER_SHARED_DATA_SYSTEM_TIME 0x14
|
||||||
|
#define USER_SHARED_DATA_TICK_COUNT 0x320
|
||||||
|
|
||||||
|
//
|
||||||
|
// KUSER_SHARED_DATA Offsets (this stuff is trash)
|
||||||
|
//
|
||||||
#define KERNEL_USER_SHARED_DATA 0x7FFE0000
|
#define KERNEL_USER_SHARED_DATA 0x7FFE0000
|
||||||
#define KUSER_SHARED_PROCESSOR_FEATURES KERNEL_USER_SHARED_DATA + 0x274
|
#define KUSER_SHARED_PROCESSOR_FEATURES KERNEL_USER_SHARED_DATA + 0x274
|
||||||
#define KUSER_SHARED_SYSCALL KERNEL_USER_SHARED_DATA + 0x300
|
#define KUSER_SHARED_SYSCALL KERNEL_USER_SHARED_DATA + 0x300
|
||||||
|
|
|
@ -231,7 +231,8 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KeUpdateSystemTime(
|
KeUpdateSystemTime(
|
||||||
PKTRAP_FRAME TrapFrame,
|
PKTRAP_FRAME TrapFrame,
|
||||||
KIRQL Irql
|
KIRQL Irql,
|
||||||
|
ULONG Increment
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -258,13 +258,6 @@ BOOLEAN
|
||||||
STDCALL
|
STDCALL
|
||||||
KiRosPrintAddress(PVOID Address);
|
KiRosPrintAddress(PVOID Address);
|
||||||
|
|
||||||
VOID
|
|
||||||
STDCALL
|
|
||||||
KeUpdateSystemTime(
|
|
||||||
PKTRAP_FRAME TrapFrame,
|
|
||||||
KIRQL Irql
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
KeUpdateRunTime(
|
KeUpdateRunTime(
|
||||||
|
|
|
@ -63,6 +63,7 @@ extern LIST_ENTRY KiTimerListHead;
|
||||||
|
|
||||||
ULONG KeMaximumIncrement = 100000;
|
ULONG KeMaximumIncrement = 100000;
|
||||||
ULONG KeMinimumIncrement = 100000;
|
ULONG KeMinimumIncrement = 100000;
|
||||||
|
ULONG KeTimeAdjustment = 100000;
|
||||||
|
|
||||||
#define MICROSECONDS_PER_TICK (10000)
|
#define MICROSECONDS_PER_TICK (10000)
|
||||||
#define TICKS_TO_CALIBRATE (1)
|
#define TICKS_TO_CALIBRATE (1)
|
||||||
|
@ -353,23 +354,23 @@ KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame,
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
|
KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
|
||||||
IN KIRQL Irql)
|
IN KIRQL Irql,
|
||||||
|
IN ULONG Increment)
|
||||||
{
|
{
|
||||||
LONG OldOffset;
|
LONG OldOffset;
|
||||||
LARGE_INTEGER Time;
|
LARGE_INTEGER Time;
|
||||||
ASSERT(KeGetCurrentIrql() == PROFILE_LEVEL);
|
ASSERT(KeGetCurrentIrql() == PROFILE_LEVEL);
|
||||||
if (!KiClockSetupComplete) return;
|
|
||||||
|
|
||||||
/* Update interrupt time */
|
/* Update interrupt time */
|
||||||
Time.LowPart = SharedUserData->InterruptTime.LowPart;
|
Time.LowPart = SharedUserData->InterruptTime.LowPart;
|
||||||
Time.HighPart = SharedUserData->InterruptTime.High1Time;
|
Time.HighPart = SharedUserData->InterruptTime.High1Time;
|
||||||
Time.QuadPart += CLOCK_INCREMENT;
|
Time.QuadPart += Increment;
|
||||||
SharedUserData->InterruptTime.High2Time = Time.u.HighPart;
|
SharedUserData->InterruptTime.High2Time = Time.u.HighPart;
|
||||||
SharedUserData->InterruptTime.LowPart = Time.u.LowPart;
|
SharedUserData->InterruptTime.LowPart = Time.u.LowPart;
|
||||||
SharedUserData->InterruptTime.High1Time = Time.u.HighPart;
|
SharedUserData->InterruptTime.High1Time = Time.u.HighPart;
|
||||||
|
|
||||||
/* Increase the tick offset */
|
/* Increase the tick offset */
|
||||||
KiTickOffset -= CLOCK_INCREMENT;
|
KiTickOffset -= Increment;
|
||||||
OldOffset = KiTickOffset;
|
OldOffset = KiTickOffset;
|
||||||
|
|
||||||
/* Check if this isn't a tick yet */
|
/* Check if this isn't a tick yet */
|
||||||
|
@ -380,28 +381,39 @@ KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This was a tick, calculate the next one */
|
|
||||||
KiTickOffset += CLOCK_INCREMENT;
|
|
||||||
|
|
||||||
/* Setup time structure for system time */
|
/* Setup time structure for system time */
|
||||||
Time.LowPart = SharedUserData->SystemTime.LowPart;
|
Time.LowPart = SharedUserData->SystemTime.LowPart;
|
||||||
Time.HighPart = SharedUserData->SystemTime.High1Time;
|
Time.HighPart = SharedUserData->SystemTime.High1Time;
|
||||||
Time.QuadPart += CLOCK_INCREMENT;
|
Time.QuadPart += KeTimeAdjustment;
|
||||||
SharedUserData->SystemTime.High2Time = Time.HighPart;
|
SharedUserData->SystemTime.High2Time = Time.HighPart;
|
||||||
SharedUserData->SystemTime.LowPart = Time.LowPart;
|
SharedUserData->SystemTime.LowPart = Time.LowPart;
|
||||||
SharedUserData->SystemTime.High1Time = Time.HighPart;
|
SharedUserData->SystemTime.High1Time = Time.HighPart;
|
||||||
|
|
||||||
/* Update tick count */
|
/* Setup time structure for tick time */
|
||||||
(*(PULONGLONG)&KeTickCount)++;
|
Time.LowPart = KeTickCount.LowPart;
|
||||||
|
Time.HighPart = KeTickCount.High1Time;
|
||||||
|
Time.QuadPart += 1;
|
||||||
|
KeTickCount.High2Time = Time.HighPart;
|
||||||
|
KeTickCount.LowPart = Time.LowPart;
|
||||||
|
KeTickCount.High1Time = Time.HighPart;
|
||||||
|
SharedUserData->TickCount.High2Time = Time.HighPart;
|
||||||
|
SharedUserData->TickCount.LowPart = Time.LowPart;
|
||||||
|
SharedUserData->TickCount.High1Time = Time.HighPart;
|
||||||
|
|
||||||
|
/* Update tick count in shared user data as well */
|
||||||
SharedUserData->TickCountLowDeprecated++;
|
SharedUserData->TickCountLowDeprecated++;
|
||||||
KiRawTicks++;
|
|
||||||
|
|
||||||
/* Queue a DPC that will expire timers */
|
/* Queue a DPC that will expire timers */
|
||||||
KeInsertQueueDpc(&KiExpireTimerDpc, (PVOID)TrapFrame->Eip, 0);
|
KeInsertQueueDpc(&KiExpireTimerDpc, (PVOID)TrapFrame->Eip, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update process and thread times */
|
/* Update process and thread times */
|
||||||
if (OldOffset <= 0) KeUpdateRunTime(TrapFrame, Irql);
|
if (OldOffset <= 0)
|
||||||
|
{
|
||||||
|
/* This was a tick, calculate the next one */
|
||||||
|
KiTickOffset += KeMaximumIncrement;
|
||||||
|
KeUpdateRunTime(TrapFrame, Irql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -153,8 +153,11 @@ KiInterruptDispatch (ULONG vector, PKIRQ_TRAPFRAME Trapframe)
|
||||||
Ke386EnableInterrupts();
|
Ke386EnableInterrupts();
|
||||||
|
|
||||||
//DPRINT1("Tick\n");
|
//DPRINT1("Tick\n");
|
||||||
|
if (KiClockSetupComplete)
|
||||||
|
{
|
||||||
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
|
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
|
||||||
KeUpdateSystemTime(&KernelTrapFrame, old_level);
|
KeUpdateSystemTime(&KernelTrapFrame, old_level, 100000);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End the system interrupt.
|
* End the system interrupt.
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <internal/i386/asmmacro.S>
|
#include <internal/i386/asmmacro.S>
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
.globl _KiIdt
|
.globl _KiIdt
|
||||||
_KiIdt:
|
_KiIdt:
|
||||||
|
|
|
@ -648,7 +648,7 @@ KeTerminateThread@4
|
||||||
KeTickCount DATA
|
KeTickCount DATA
|
||||||
@KeTryToAcquireGuardedMutex@4
|
@KeTryToAcquireGuardedMutex@4
|
||||||
KeUpdateRunTime@8
|
KeUpdateRunTime@8
|
||||||
KeUpdateSystemTime@8
|
KeUpdateSystemTime@12
|
||||||
KeUnstackDetachProcess@4
|
KeUnstackDetachProcess@4
|
||||||
KeUserModeCallback@20
|
KeUserModeCallback@20
|
||||||
KeWaitForMultipleObjects@32
|
KeWaitForMultipleObjects@32
|
||||||
|
|
Loading…
Reference in a new issue