Several changes for timestamp bundle:

Fully defined the structure.
Single copy of it + single timer across all modules, managing it is now the responsibility of KernelState.

add global_critical_region::PrepareToAcquire, which uses Prefetchw on the global crit. We now know we can use Prefetchw on all cpus that have AVX.
add  KeQueryInterruptTime, which is used by some dashboards.

add threading::NanoSleep
This commit is contained in:
chss95cs@gmail.com
2023-04-16 10:08:01 -04:00
parent 12c9135843
commit ab21e1e0f0
15 changed files with 147 additions and 54 deletions

View File

@@ -35,8 +35,9 @@
#undef GetFirstChild
#define XE_USE_NTDLL_FUNCTIONS 1
//chrispy: disabling this for now, more research needs to be done imo, although it does work very well on my machine
//
// chrispy: disabling this for now, more research needs to be done imo, although
// it does work very well on my machine
//
#define XE_USE_KUSER_SHARED 0
#if XE_USE_NTDLL_FUNCTIONS == 1
/*
@@ -63,7 +64,11 @@
#define XE_NTDLL_IMPORT(name, cls, clsvar) static constexpr bool clsvar = false
#endif
#if XE_USE_KUSER_SHARED==1
static constexpr size_t KSUER_SHARED_SYSTEMTIME_OFFSET = 0x14;
static constexpr size_t KUSER_SHARED_INTERRUPTTIME_OFFSET = 8;
static unsigned char* KUserShared() { return (unsigned char*)0x7FFE0000ULL; }
#if XE_USE_KUSER_SHARED == 1
// KUSER_SHARED
struct __declspec(align(4)) _KSYSTEM_TIME {
unsigned int LowPart;
@@ -71,8 +76,6 @@ struct __declspec(align(4)) _KSYSTEM_TIME {
int High2Time;
};
static constexpr size_t KSUER_SHARED_SYSTEMTIME_OFFSET = 0x14;
static unsigned char* KUserShared() { return (unsigned char*)0x7FFE0000ULL; }
static volatile _KSYSTEM_TIME* GetKUserSharedSystemTime() {
return reinterpret_cast<volatile _KSYSTEM_TIME*>(
KUserShared() + KSUER_SHARED_SYSTEMTIME_OFFSET);