Extend KSD with InterruptTime
All checks were successful
All checks were successful
This commit is contained in:
@@ -21,9 +21,11 @@ namespace KE
|
||||
STATIC PKSHARED_DATA KernelSharedData;
|
||||
|
||||
public:
|
||||
STATIC XTAPI LARGE_INTEGER GetInterruptTime(VOID);
|
||||
STATIC XTAPI PKSHARED_DATA GetKernelSharedData(VOID);
|
||||
STATIC XTAPI LARGE_INTEGER GetSystemTime(VOID);
|
||||
STATIC XTAPI VOID InitializeKernelSharedData(VOID);
|
||||
STATIC XTAPI VOID SetInterruptTime(IN LARGE_INTEGER Time);
|
||||
STATIC XTAPI VOID SetSystemTime(IN LARGE_INTEGER Time);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,35 @@
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the current interrupt time using a lock-free read mechanism.
|
||||
*
|
||||
* @return This routine returns a LARGE_INTEGER containing the interrupt time.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
LARGE_INTEGER
|
||||
KE::SharedData::GetInterruptTime(VOID)
|
||||
{
|
||||
LARGE_INTEGER InterruptTime;
|
||||
|
||||
/* Initialize to zero */
|
||||
InterruptTime.QuadPart = 0;
|
||||
|
||||
/* Perform a lock-free read sequence */
|
||||
do
|
||||
{
|
||||
/* Read the primary high part and low part */
|
||||
InterruptTime.HighPart = KernelSharedData->SystemTime.High1Part;
|
||||
InterruptTime.LowPart = KernelSharedData->SystemTime.LowPart;
|
||||
}
|
||||
while(InterruptTime.HighPart != KernelSharedData->SystemTime.High2Part);
|
||||
|
||||
/* Return the 64-bit time */
|
||||
return InterruptTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a pointer to the memory-mapped Kernel Shared Data.
|
||||
*
|
||||
@@ -108,6 +137,26 @@ KE::SharedData::InitializeKernelSharedData(VOID)
|
||||
(sizeof(KernelSharedData->XtFullDate) / sizeof(WCHAR)) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the global interrupt time using a strict lock-free write mechanism.
|
||||
*
|
||||
* @param Time
|
||||
* Supplies the new interrupt time as a 64-bit LARGE_INTEGER value.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
VOID
|
||||
KE::SharedData::SetInterruptTime(IN LARGE_INTEGER Time)
|
||||
{
|
||||
/* Set the new interrupt time */
|
||||
KernelSharedData->InterruptTime.High2Part = Time.HighPart;
|
||||
KernelSharedData->InterruptTime.LowPart = Time.LowPart;
|
||||
KernelSharedData->InterruptTime.High1Part = Time.HighPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the global system time using a strict lock-free write mechanism.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user