Add TickCount to Kernel Shared Data
All checks were successful
All checks were successful
This commit is contained in:
@@ -462,6 +462,7 @@ typedef struct _KSHARED_DATA
|
||||
{
|
||||
VOLATILE KSYSTEM_TIME InterruptTime;
|
||||
VOLATILE KSYSTEM_TIME SystemTime;
|
||||
VOLATILE KSYSTEM_TIME TickCount;
|
||||
ULONG XtMajorVersion;
|
||||
ULONG XtMinorVersion;
|
||||
WCHAR XtBuild[8];
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace KE
|
||||
STATIC XTAPI LARGE_INTEGER GetInterruptTime(VOID);
|
||||
STATIC XTAPI PKSHARED_DATA GetKernelSharedData(VOID);
|
||||
STATIC XTAPI LARGE_INTEGER GetSystemTime(VOID);
|
||||
STATIC XTAPI LARGE_INTEGER GetTickCount(VOID);
|
||||
STATIC XTAPI VOID IncrementTickCount();
|
||||
STATIC XTAPI VOID InitializeKernelSharedData(VOID);
|
||||
STATIC XTAPI VOID SetInterruptTime(IN LARGE_INTEGER Time);
|
||||
STATIC XTAPI VOID SetSystemTime(IN LARGE_INTEGER Time);
|
||||
|
||||
@@ -82,6 +82,48 @@ KE::SharedData::GetSystemTime(VOID)
|
||||
return CurrentTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the global system tick count.
|
||||
*
|
||||
* @return This routine returns the current tick count.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
LARGE_INTEGER
|
||||
KE::SharedData::GetTickCount(VOID)
|
||||
{
|
||||
LARGE_INTEGER Ticks;
|
||||
|
||||
/* Read the 64-bit tick count */
|
||||
Ticks.QuadPart = (*(ULONGLONG*)&KernelSharedData->TickCount);
|
||||
|
||||
/* Return the retrieved tick count */
|
||||
return Ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the global system tick count by one using a strict lock-free write mechanism.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
VOID
|
||||
KE::SharedData::IncrementTickCount()
|
||||
{
|
||||
LARGE_INTEGER Ticks;
|
||||
|
||||
/* Increment tick count */
|
||||
Ticks.QuadPart = (*(ULONGLONG*)&KernelSharedData->TickCount) + 1;
|
||||
|
||||
/* Set the new tick count */
|
||||
KernelSharedData->TickCount.High2Part = Ticks.HighPart;
|
||||
KernelSharedData->TickCount.LowPart = Ticks.LowPart;
|
||||
KernelSharedData->TickCount.High1Part = Ticks.HighPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps and initializes the Kernel Shared Data (KSD) structure.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user