Add TickCount to Kernel Shared Data
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in -59m24s
Builds / ExectOS (amd64, release) (push) Successful in -59m27s
Builds / ExectOS (i686, release) (push) Successful in -59m28s
Builds / ExectOS (i686, debug) (push) Successful in -59m26s

This commit is contained in:
2026-05-05 22:47:32 +02:00
parent ba85c88544
commit 27440aefc4
3 changed files with 45 additions and 0 deletions

View File

@@ -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];

View File

@@ -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);

View File

@@ -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.
*