add page cache with read-ahead and dirty writeback, file-backed and anonymous mmap with CoW, VAD-based virtual memory replacing the old user region model, PFN database with eviction and reclaim, file identity for cross-open section sharing, FAT32 path cache and per-file cluster chain cache, serial.sys for COM1 keyboard input, xHCI MSI with INTx and polled fallback, PciEnableMsiAuto, waitable input queue, KeWaitForAnyEvent, per-process thread info syscall, expanded kernel stats (PFN/PTE/VAD/file-cache/disk), pool allocation tags, async I/O user buffer locking, file flush on close, add docs.md.
This commit is contained in:
1 parent
61ec2442eb
commit
2c4a68a75f
114 files changed
+18069
-2620
No files matched your search
@@ -120,7 +120,7 @@ typedef struct HAL_INIT_PARAMS {
|
||||
void* (*AllocatePool)(size_t size);
|
||||
} HAL_INIT_PARAMS;
|
||||
|
||||
#define HAL_API_VERSION 5
|
||||
#define HAL_API_VERSION // do not change during development
|
||||
|
||||
__declspec(dllexport) const HAL_API* HalGetApi(void);
|
||||
__declspec(dllexport) void HalRegisterScheduler(void (*pKeSchedulerTick)(void));
|
||||
|
||||
@@ -179,6 +179,27 @@ typedef void (*IO_DISK_ARRIVAL_CALLBACK)(uint8_t driveIndex,
|
||||
DEVICE_OBJECT* device,
|
||||
void* context);
|
||||
|
||||
typedef struct IO_DISK_STATS {
|
||||
uint64_t RegisteredDisks;
|
||||
uint64_t ReadRequests;
|
||||
uint64_t ReadSectors;
|
||||
uint64_t WriteRequests;
|
||||
uint64_t WriteSectors;
|
||||
uint64_t MaxReadSectors;
|
||||
uint64_t MaxWriteSectors;
|
||||
uint64_t ReadaheadHits;
|
||||
uint64_t ReadaheadMisses;
|
||||
uint64_t ReadaheadStores;
|
||||
uint64_t ReadaheadInvalidations;
|
||||
uint64_t ReadaheadBytesServed;
|
||||
uint64_t ReadaheadSectorsLoaded;
|
||||
uint64_t ReadaheadSequentialDetections;
|
||||
uint64_t ReadaheadSuppressed;
|
||||
uint64_t ReadaheadAllocFailures;
|
||||
uint64_t ReadaheadReadFailures;
|
||||
uint64_t MaxReadaheadSectors;
|
||||
} IO_DISK_STATS;
|
||||
|
||||
__declspec(dllexport) KSTATUS IoRegisterDiskDevice(uint8_t driveIndex,
|
||||
DEVICE_OBJECT* device);
|
||||
__declspec(dllexport) KSTATUS IoNotifyDiskSurpriseRemoved(uint8_t driveIndex);
|
||||
@@ -203,3 +224,4 @@ __declspec(dllexport) KSTATUS IoWriteDiskSectors(uint8_t driveIndex,
|
||||
uint64_t lba,
|
||||
uint32_t count,
|
||||
const void* buffer);
|
||||
__declspec(dllexport) void IoQueryDiskStats(IO_DISK_STATS* out);
|
||||
@@ -118,3 +118,6 @@ PCI_API KSTATUS PciGetInterrupt(DEVICE_OBJECT* pdo,
|
||||
|
||||
PCI_API KSTATUS PciEnableMsi(DEVICE_OBJECT* pdo,
|
||||
uint8_t irqSlot);
|
||||
|
||||
PCI_API KSTATUS PciEnableMsiAuto(DEVICE_OBJECT* pdo,
|
||||
uint8_t* outIrqSlot);
|
||||
@@ -32,6 +32,43 @@ typedef struct DISPLAY_RECT {
|
||||
int32_t H;
|
||||
} DISPLAY_RECT;
|
||||
|
||||
|
||||
#define SYS_SURFACE_FORMAT_XRGB8888 1u
|
||||
#define SYS_SURFACE_FLAG_NONE 0u
|
||||
#define SYS_SURFACE_MAX_RECTS 64u
|
||||
|
||||
typedef struct SYS_SURFACE_DESC {
|
||||
uint32_t Width;
|
||||
uint32_t Height;
|
||||
uint32_t PitchBytes;
|
||||
uint32_t Format;
|
||||
void* Base;
|
||||
uint64_t PayloadBytes;
|
||||
uint64_t PageCount;
|
||||
uint64_t MapCount;
|
||||
uint64_t PresentCount;
|
||||
uint64_t PresentRectCount;
|
||||
uint64_t PresentClippedRectCount;
|
||||
uint64_t PresentEmptyClipCount;
|
||||
uint64_t PresentRowsCopied;
|
||||
uint64_t PresentBytesCopied;
|
||||
} SYS_SURFACE_DESC;
|
||||
|
||||
typedef struct SYS_SURFACE_STATS {
|
||||
uint64_t CreatedSurfaces;
|
||||
uint64_t DestroyedSurfaces;
|
||||
uint64_t LiveSurfaces;
|
||||
uint64_t LivePages;
|
||||
uint64_t LiveBytes;
|
||||
uint64_t MapCalls;
|
||||
uint64_t PresentCalls;
|
||||
uint64_t PresentRectInputs;
|
||||
uint64_t PresentClippedRects;
|
||||
uint64_t PresentEmptyClips;
|
||||
uint64_t PresentRowsCopied;
|
||||
uint64_t PresentBytesCopied;
|
||||
} SYS_SURFACE_STATS;
|
||||
|
||||
typedef struct DISPLAY_STATS {
|
||||
uint64_t BlitCount;
|
||||
uint64_t FillRectCount;
|
||||
|
||||
@@ -136,6 +136,13 @@ typedef struct INPUT_KEY_EVENT {
|
||||
bool Pressed;
|
||||
} INPUT_KEY_EVENT;
|
||||
|
||||
typedef struct INPUT_KEY_RECORD {
|
||||
INPUT_KEY Key;
|
||||
char Char;
|
||||
uint8_t Reserved;
|
||||
uint32_t Modifiers;
|
||||
} INPUT_KEY_RECORD;
|
||||
|
||||
typedef struct INPUT_MOUSE_EVENT {
|
||||
int dx;
|
||||
int dy;
|
||||
|
||||
@@ -45,4 +45,26 @@ typedef uint32_t KSTATUS;
|
||||
// --- Execution level (0x0060) ---.
|
||||
#define STATUS_INVALID_IRQL ((KSTATUS)0x0060)
|
||||
|
||||
// --- Process termination reasons ---.
|
||||
// Low values are reserved for ordinary KSTATUS returns. Abnormal process
|
||||
// termination uses a high-bit private range so exit statuses cannot collide
|
||||
// with normal kernel/API result codes.
|
||||
//
|
||||
// Layout:
|
||||
// 31 : set => abnormal/private status
|
||||
// 30..24 : subsystem group
|
||||
// 23..0 : group-local reason
|
||||
//
|
||||
// Group 0x61 is process termination/fault status.
|
||||
#define STATUS_PRIVATE_BASE ((KSTATUS)0x80000000u)
|
||||
#define STATUS_PROCESS_BASE ((KSTATUS)0xE1000000u)
|
||||
#define STATUS_PROCESS_KILLED ((KSTATUS)(STATUS_PROCESS_BASE | 0x0000u))
|
||||
#define STATUS_PROCESS_PAGE_FAULT ((KSTATUS)(STATUS_PROCESS_BASE | 0x0010u))
|
||||
#define STATUS_PROCESS_GENERAL_PROTECTION ((KSTATUS)(STATUS_PROCESS_BASE | 0x0011u))
|
||||
#define STATUS_PROCESS_ILLEGAL_OPCODE ((KSTATUS)(STATUS_PROCESS_BASE | 0x0012u))
|
||||
#define STATUS_PROCESS_DIVIDE_BY_ZERO ((KSTATUS)(STATUS_PROCESS_BASE | 0x0013u))
|
||||
#define STATUS_PROCESS_BREAKPOINT ((KSTATUS)(STATUS_PROCESS_BASE | 0x0014u))
|
||||
#define STATUS_PROCESS_ALIGNMENT_FAULT ((KSTATUS)(STATUS_PROCESS_BASE | 0x0015u))
|
||||
#define STATUS_PROCESS_UNKNOWN_FAULT ((KSTATUS)(STATUS_PROCESS_BASE | 0x001Fu))
|
||||
|
||||
#define KSUCCESS(s) ((s) == STATUS_SUCCESS)
|
||||
+376
-13
@@ -18,7 +18,11 @@
|
||||
#define SYS_STATUS_PENDING 4u
|
||||
#define SYS_STATUS_ALERTED 5u
|
||||
#define SYS_STATUS_INVALID_PARAMETER 0x10u
|
||||
#define SYS_STATUS_INVALID_HANDLE 0x11u
|
||||
#define SYS_STATUS_BUFFER_TOO_SMALL 0x12u
|
||||
#define SYS_STATUS_NOT_SUPPORTED 0x02u
|
||||
#define SYS_STATUS_NO_MEMORY 0x20u
|
||||
#define SYS_STATUS_ACCESS_DENIED 0x21u
|
||||
#define SYS_STATUS_KERNEL_APC 6u
|
||||
#define SYS_STATUS_USER_APC 7u
|
||||
#define SYS_STATUS_CANCELLED 0x33u
|
||||
@@ -30,6 +34,7 @@
|
||||
#define SYS_TEB_MAGIC 0x30424554u // "TEB0"
|
||||
#define SYS_ENV_VERSION 1u
|
||||
#define SYS_CWD_MAX 520u
|
||||
#define SYS_PATH_MAX 1024u
|
||||
|
||||
#ifndef SYS_USER_ENV_TYPES_DEFINED
|
||||
#define SYS_USER_ENV_TYPES_DEFINED 1
|
||||
@@ -52,9 +57,7 @@ typedef struct SYS_TEB {
|
||||
uint32_t ThreadId;
|
||||
uint32_t Magic;
|
||||
|
||||
// Native per-thread extension pointer. The kernel leaves this NULL;
|
||||
// user-mode personalities/libraries may hang their own thread-local
|
||||
// state here without baking subsystem semantics into SYS_TEB.
|
||||
// =The kernel leaves this NULL, userspace can modify and use.
|
||||
void* SubsystemData;
|
||||
} SYS_TEB;
|
||||
|
||||
@@ -80,6 +83,27 @@ typedef void (*SYS_USER_APC_ROUTINE)(void* normalContext,
|
||||
SYS_IO_STATUS_BLOCK* iosb,
|
||||
uint64_t information);
|
||||
|
||||
typedef struct SYS_FILE_IO_REQUEST {
|
||||
uint32_t FileHandle;
|
||||
uint32_t Flags;
|
||||
void* Buffer;
|
||||
size_t Size;
|
||||
size_t* TransferredOut;
|
||||
} SYS_FILE_IO_REQUEST;
|
||||
|
||||
static inline SYS_FILE_IO_REQUEST SysMakeFileIoRequest(uint32_t fileHandle,
|
||||
const void* buffer,
|
||||
size_t size,
|
||||
size_t* transferredOut) {
|
||||
SYS_FILE_IO_REQUEST request;
|
||||
request.FileHandle = fileHandle;
|
||||
request.Flags = 0;
|
||||
request.Buffer = (void*)(uintptr_t)buffer;
|
||||
request.Size = size;
|
||||
request.TransferredOut = transferredOut;
|
||||
return request;
|
||||
}
|
||||
|
||||
typedef struct SYS_ASYNC_FILE_REQUEST {
|
||||
uint32_t FileHandle;
|
||||
uint32_t EventHandle; // optional; 0 means no event signal
|
||||
@@ -181,11 +205,40 @@ typedef struct SYS_NAMED_QUEUE_OWNER_REQUEST {
|
||||
uint32_t* PidOut;
|
||||
} SYS_NAMED_QUEUE_OWNER_REQUEST;
|
||||
|
||||
#define SYS_WAIT_FLAG_NONE 0x00000000u
|
||||
#define SYS_WAIT_FLAG_ALERTABLE 0x00000001u
|
||||
#define SYS_WAIT_TIMEOUT_INFINITE UINT64_MAX
|
||||
#define SYS_WAIT_MANY_MAX_HANDLES 32u
|
||||
|
||||
typedef struct SYS_WAIT_MANY_REQUEST {
|
||||
uint32_t Size;
|
||||
uint32_t Flags;
|
||||
const uint32_t* Handles;
|
||||
uint32_t Count;
|
||||
uint32_t* SignaledIndexOut;
|
||||
uint64_t TimeoutMilliseconds;
|
||||
} SYS_WAIT_MANY_REQUEST;
|
||||
|
||||
typedef struct SYS_CREATE_THREAD_REQUEST {
|
||||
uintptr_t Entry;
|
||||
uintptr_t Argument;
|
||||
uint32_t Priority;
|
||||
uint32_t Flags;
|
||||
uint32_t* ThreadHandleOut;
|
||||
uint32_t* ThreadIdOut;
|
||||
} SYS_CREATE_THREAD_REQUEST;
|
||||
|
||||
// Process & thread lifecycle (0-14).
|
||||
void SysExitProcess(int exitCode);
|
||||
void SysExitThread(int exitCode);
|
||||
uint32_t SysCreateProcess(const SYS_CREATE_PROCESS_REQUEST* request);
|
||||
uint32_t SysWaitForProcess(uint32_t handle);
|
||||
uint32_t SysWaitSingle(uint32_t handle, uint32_t flags, uint64_t timeoutMilliseconds);
|
||||
uint32_t SysWaitMany(const SYS_WAIT_MANY_REQUEST* request);
|
||||
uint32_t SysOpenInputQueue(uint32_t flags, uint32_t* handleOut);
|
||||
|
||||
static inline uint32_t SysWait(uint32_t handle, uint32_t flags) {
|
||||
return SysWaitSingle(handle, flags, SYS_WAIT_TIMEOUT_INFINITE);
|
||||
}
|
||||
uint32_t SysGetProcessExitCode(uint32_t handle, int* exitCodeOut);
|
||||
uint32_t SysKillProcess(uint32_t pid, int exitCode);
|
||||
|
||||
@@ -200,6 +253,61 @@ uint32_t SysKillProcess(uint32_t pid, int exitCode);
|
||||
#define SYS_PROCESS_FLAG_CURRENT 0x00000002u
|
||||
#define SYS_PROCESS_FLAG_TERMINATING 0x00000004u
|
||||
#define SYS_PROCESS_FLAG_EXITED 0x00000008u
|
||||
#define SYS_PROCESS_FLAG_IDLE 0x00000010u
|
||||
|
||||
#define SYS_THREAD_STATE_READY 0u
|
||||
#define SYS_THREAD_STATE_RUNNING 1u
|
||||
#define SYS_THREAD_STATE_WAITING 2u
|
||||
#define SYS_THREAD_STATE_DEAD 3u
|
||||
|
||||
#define SYS_THREAD_FLAG_CURRENT 0x00000001u
|
||||
#define SYS_THREAD_FLAG_IDLE 0x00000002u
|
||||
#define SYS_THREAD_FLAG_KERNEL 0x00000004u
|
||||
#define SYS_THREAD_FLAG_QUEUED 0x00000008u
|
||||
#define SYS_THREAD_FLAG_ALERTABLE_WAIT 0x00000010u
|
||||
#define SYS_THREAD_FLAG_KERNEL_APC_PENDING 0x00000020u
|
||||
#define SYS_THREAD_FLAG_USER_APC_PENDING 0x00000040u
|
||||
|
||||
#define SYS_THREAD_WAIT_NONE 0u
|
||||
#define SYS_THREAD_WAIT_PROCESS 1u
|
||||
#define SYS_THREAD_WAIT_THREAD 2u
|
||||
#define SYS_THREAD_WAIT_MUTEX 3u
|
||||
#define SYS_THREAD_WAIT_SEMAPHORE 4u
|
||||
#define SYS_THREAD_WAIT_EVENT 5u
|
||||
#define SYS_THREAD_WAIT_QUEUE 6u
|
||||
#define SYS_THREAD_WAIT_FILE 7u
|
||||
#define SYS_THREAD_WAIT_DIR 8u
|
||||
#define SYS_THREAD_WAIT_ASYNC_IO 9u
|
||||
#define SYS_THREAD_WAIT_SOCKET 10u
|
||||
#define SYS_THREAD_WAIT_DEVICE 11u
|
||||
#define SYS_THREAD_WAIT_DRIVER 12u
|
||||
#define SYS_THREAD_WAIT_USB_DEVICE 13u
|
||||
#define SYS_THREAD_WAIT_USB_PIPE 14u
|
||||
#define SYS_THREAD_WAIT_FILE_MAPPING 15u
|
||||
#define SYS_THREAD_WAIT_SURFACE 16u
|
||||
#define SYS_THREAD_WAIT_UNKNOWN 0xffffffffu
|
||||
|
||||
typedef struct SYS_THREAD_INFO {
|
||||
uint32_t Size;
|
||||
uint32_t ProcessId;
|
||||
uint32_t ThreadId;
|
||||
uint32_t State;
|
||||
|
||||
uint32_t Priority;
|
||||
uint32_t Flags;
|
||||
uint32_t RunningCpu;
|
||||
uint32_t LastCpu;
|
||||
|
||||
uint32_t QuantumRemaining;
|
||||
uint32_t QuantumTicks;
|
||||
uint32_t CpuBurstTicks;
|
||||
uint32_t LastRunTicks;
|
||||
|
||||
uint32_t WaitObjectType;
|
||||
uint32_t WaitStatus;
|
||||
int32_t KernelApcDisable;
|
||||
uint32_t Reserved0;
|
||||
} SYS_THREAD_INFO;
|
||||
|
||||
typedef struct SYS_PROCESS_INFO {
|
||||
uint32_t Size;
|
||||
@@ -219,7 +327,7 @@ typedef struct SYS_PROCESS_INFO {
|
||||
size_t ImageSize;
|
||||
uintptr_t PebBase;
|
||||
|
||||
size_t UserRegionCount;
|
||||
size_t VadCount;
|
||||
size_t UserReservedBytes;
|
||||
size_t UserCommittedBytes;
|
||||
|
||||
@@ -229,9 +337,9 @@ typedef struct SYS_PROCESS_INFO {
|
||||
|
||||
uint32_t SysGetProcessList(SYS_PROCESS_INFO* processesOut, size_t maxCount, size_t* countOut);
|
||||
uint32_t SysGetProcessPid(uint32_t handle, uint32_t* pidOut);
|
||||
uint32_t SysGetThreadList(uint32_t pid, SYS_THREAD_INFO* threadsOut, size_t maxCount, size_t* countOut);
|
||||
|
||||
uint32_t SysCreateThread(uintptr_t entry, uintptr_t arg, uint32_t priority, uint32_t* tidOut);
|
||||
uint32_t SysWaitThread(uint32_t tid);
|
||||
uint32_t SysCreateThread(const SYS_CREATE_THREAD_REQUEST* request);
|
||||
uint32_t SysGetCurrentTid(void);
|
||||
uint32_t SysGetCurrentPid(void);
|
||||
uint32_t SysSetThreadPriority(uint32_t priority);
|
||||
@@ -266,23 +374,32 @@ uint32_t SysAllocVm(void* preferredBase, size_t pageCount, uint32_t protect, uin
|
||||
uint32_t SysFreeVm(void* base);
|
||||
uint32_t SysProtectVm(void* base, size_t pageCount, uint32_t protect, uint32_t* oldProtectOut);
|
||||
uint32_t SysQueryVm(void* address, SYS_VM_REGION_INFO* out);
|
||||
|
||||
#define SYS_MAP_ACCESS_READ 0x00000001u
|
||||
#define SYS_MAP_ACCESS_WRITE 0x00000002u
|
||||
#define SYS_MAP_ACCESS_COPY 0x00000004u
|
||||
#define SYS_MAP_ACCESS_EXECUTE 0x00000008u
|
||||
#define SYS_MAP_FLAG_NONE 0x00000000u
|
||||
|
||||
uint32_t SysCreateFileMapping(uint32_t fileHandle, uint32_t protect, uint32_t flags,
|
||||
uint64_t maximumSize, uint32_t* mappingHandleOut);
|
||||
uint32_t SysMapFile(uint32_t mappingHandle, uint64_t offset, size_t size,
|
||||
uint32_t access, uint32_t flags, void** baseOut);
|
||||
uint32_t SysCloseHandle(uint32_t handle);
|
||||
|
||||
// Synchronization primitives (19-31).
|
||||
uint32_t SysCreateMutex(uint32_t* handleOut);
|
||||
uint32_t SysAcquireMutex(uint32_t handle);
|
||||
uint32_t SysTryAcquireMutex(uint32_t handle);
|
||||
uint32_t SysReleaseMutex(uint32_t handle);
|
||||
|
||||
uint32_t SysCreateSem(int32_t initial, int32_t max, uint32_t* handleOut);
|
||||
uint32_t SysWaitSem(uint32_t handle);
|
||||
uint32_t SysTryWaitSem(uint32_t handle);
|
||||
uint32_t SysSignalSem(uint32_t handle);
|
||||
|
||||
uint32_t SysCreateEvent(uint32_t type, uint32_t initialState, uint32_t* handleOut);
|
||||
uint32_t SysSignalEvent(uint32_t handle);
|
||||
uint32_t SysClearEvent(uint32_t handle);
|
||||
uint32_t SysWaitEvent(uint32_t handle, uint32_t alertable);
|
||||
|
||||
|
||||
// Queues and named queues (32-38).
|
||||
uint32_t SysCreateQueue(uint32_t* handleOut);
|
||||
@@ -296,8 +413,8 @@ uint32_t SysGetNamedQueueOwnerPid(const SYS_NAMED_QUEUE_OWNER_REQUEST* request);
|
||||
// Files, directories, and current directory (39-56).
|
||||
uint32_t SysOpenFile(const SYS_PATH_HANDLE_REQUEST* request);
|
||||
uint32_t SysCreateFile(const SYS_PATH_HANDLE_REQUEST* request);
|
||||
uint32_t SysReadFile(uint32_t handle, void* buf, size_t size, size_t* bytesRead);
|
||||
uint32_t SysWriteFile(uint32_t handle, const void* buf, size_t size, size_t* written);
|
||||
uint32_t SysReadFile(const SYS_FILE_IO_REQUEST* request);
|
||||
uint32_t SysWriteFile(const SYS_FILE_IO_REQUEST* request);
|
||||
uint32_t SysReadFileAsync(const SYS_ASYNC_FILE_REQUEST* request);
|
||||
uint32_t SysWriteFileAsync(const SYS_ASYNC_FILE_REQUEST* request);
|
||||
uint32_t SysCancelIo(uint32_t asyncRequestHandle);
|
||||
@@ -305,6 +422,7 @@ uint32_t SysSeekFile(uint32_t handle, uint64_t offset);
|
||||
uint64_t SysGetFilePos(uint32_t handle);
|
||||
uint64_t SysGetFileSize(uint32_t handle);
|
||||
uint32_t SysTruncateFile(uint32_t handle, uint64_t newSize);
|
||||
uint32_t SysFlushFile(uint32_t handle);
|
||||
uint32_t SysDeleteFile(const SYS_PATH_REQUEST* request);
|
||||
uint32_t SysRenameFile(const SYS_RENAME_FILE_REQUEST* request);
|
||||
|
||||
@@ -330,7 +448,10 @@ uint32_t SysSetConsoleCursor(int x, int y);
|
||||
uint32_t SysFillConsoleCharacter(char c, int x, int y, size_t length, size_t* writtenOut);
|
||||
uint32_t SysFillConsoleAttribute(uint16_t attr, int x, int y, size_t length, size_t* writtenOut);
|
||||
uint32_t SysPutScreenChar(char c, int x, int y, uint32_t fg, uint32_t bg);
|
||||
uint32_t SysBlitScreen(int x, int y, int w, int h, const uint32_t* pixels);
|
||||
uint32_t SysCreateSurface(uint32_t width, uint32_t height, uint32_t format, uint32_t flags, uint32_t* handleOut);
|
||||
uint32_t SysMapSurface(uint32_t surfaceHandle, void** baseOut, uint32_t* pitchBytesOut);
|
||||
uint32_t SysQuerySurface(uint32_t surfaceHandle, SYS_SURFACE_DESC* descOut);
|
||||
uint32_t SysPresentSurface(uint32_t surfaceHandle, const DISPLAY_RECT* rects, uint32_t rectCount);
|
||||
uint32_t SysClearScreen(uint32_t color);
|
||||
uint32_t SysGetScreenSize(int* widthOut, int* heightOut);
|
||||
uint32_t SysQueryDisplayInfo(SYS_DISPLAY_INFO* infoOut);
|
||||
@@ -341,6 +462,8 @@ uint64_t SysIsKeyDown(INPUT_KEY key);
|
||||
char SysReadKeyboardChar(void);
|
||||
INPUT_KEY SysReadKey(void);
|
||||
uint32_t SysGetKeyModifiers(void);
|
||||
uint32_t SysReadInputEvent(INPUT_KEY_RECORD* recordOut);
|
||||
uint32_t SysPeekInputEvent(INPUT_KEY_RECORD* recordOut);
|
||||
|
||||
uint64_t SysPollMouse(void);
|
||||
uint64_t SysReadMouse(int* dx, int* dy, uint8_t* buttons);
|
||||
@@ -437,11 +560,25 @@ typedef struct SYS_MEMORY_STATUS {
|
||||
uint64_t FreePhysicalBytes;
|
||||
uint64_t KernelPoolBytes;
|
||||
uint64_t UserHeapBytes;
|
||||
uint64_t ReclaimablePhysicalBytes;
|
||||
uint64_t AvailablePhysicalBytes;
|
||||
uint64_t PinnedPhysicalBytes;
|
||||
uint64_t NonEvictablePhysicalBytes;
|
||||
uint64_t UserPhysicalBytes;
|
||||
uint64_t PageTablePhysicalBytes;
|
||||
} SYS_MEMORY_STATUS;
|
||||
|
||||
#define SYS_KERNEL_STATS_SCHEDULER 1u
|
||||
#define SYS_KERNEL_STATS_PMM 2u
|
||||
#define SYS_KERNEL_STATS_CPU 3u
|
||||
#define SYS_KERNEL_STATS_PFN 4u
|
||||
#define SYS_KERNEL_STATS_PTE 5u
|
||||
#define SYS_KERNEL_STATS_VAD 6u
|
||||
#define SYS_KERNEL_STATS_SWAP 7u
|
||||
#define SYS_KERNEL_STATS_FILE_CACHE 8u
|
||||
#define SYS_KERNEL_STATS_SURFACE 9u
|
||||
#define SYS_KERNEL_STATS_FILESYSTEM 10u
|
||||
#define SYS_KERNEL_STATS_DISK 11u
|
||||
|
||||
#define SYS_KERNEL_STATS_MAX_CPUS 32u
|
||||
|
||||
@@ -469,11 +606,15 @@ typedef struct SYS_PMM_STATS {
|
||||
uint64_t FreeRunHistogram[8];
|
||||
} SYS_PMM_STATS;
|
||||
|
||||
#define SYS_CPU_THREAD_FLAG_IDLE 0x00000001u
|
||||
|
||||
typedef struct SYS_CPU_STAT {
|
||||
uint32_t CpuIndex;
|
||||
uint32_t LapicId;
|
||||
uint32_t Flags;
|
||||
uint32_t CurrentTid;
|
||||
uint32_t CurrentThreadFlags;
|
||||
uint32_t Reserved0;
|
||||
uint64_t SchedulerTicks;
|
||||
uint64_t ContextSwitches;
|
||||
} SYS_CPU_STAT;
|
||||
@@ -484,6 +625,228 @@ typedef struct SYS_CPU_STATS {
|
||||
SYS_CPU_STAT Cpu[SYS_KERNEL_STATS_MAX_CPUS];
|
||||
} SYS_CPU_STATS;
|
||||
|
||||
typedef struct SYS_PFN_STATS {
|
||||
uint64_t TotalFrames;
|
||||
uint64_t FreeFrames;
|
||||
uint64_t UsedFrames;
|
||||
|
||||
uint64_t ReservedFrames;
|
||||
uint64_t ZeroedFrames;
|
||||
uint64_t ActiveFrames;
|
||||
uint64_t StandbyFrames;
|
||||
uint64_t ModifiedFrames;
|
||||
uint64_t PinnedFrames;
|
||||
uint64_t EvictableFrames;
|
||||
uint64_t NonEvictableFrames;
|
||||
uint64_t ReclaimableFrames;
|
||||
uint64_t AvailableFrames;
|
||||
uint64_t MappedFrames;
|
||||
|
||||
uint64_t KernelFrames;
|
||||
uint64_t PageTableFrames;
|
||||
uint64_t UserFrames;
|
||||
uint64_t CleanFileCacheFrames;
|
||||
uint64_t ActiveCleanFileCacheFrames;
|
||||
uint64_t StandbyCleanFileCacheFrames;
|
||||
uint64_t ImageFrames;
|
||||
uint64_t ActiveImageFrames;
|
||||
uint64_t StandbyImageFrames;
|
||||
uint64_t MappedFileFrames;
|
||||
uint64_t AnonymousFrames;
|
||||
uint64_t CowFrames;
|
||||
uint64_t SurfaceFrames;
|
||||
uint64_t DriverFrames;
|
||||
uint64_t DmaFrames;
|
||||
uint64_t BootloaderFrames;
|
||||
uint64_t PfnDatabaseFrames;
|
||||
uint64_t MmioFrames;
|
||||
|
||||
uint64_t AllocationCount;
|
||||
uint64_t FreeCount;
|
||||
uint64_t RetainCount;
|
||||
uint64_t ReleaseCount;
|
||||
uint64_t PinCount;
|
||||
uint64_t UnpinCount;
|
||||
uint64_t FailedAllocations;
|
||||
uint64_t FailedContiguousAllocations;
|
||||
|
||||
uint64_t FailedInvalidRange;
|
||||
uint64_t FailedEmptyRange;
|
||||
uint64_t FailedReserveDenied;
|
||||
uint64_t FailedNoFrame;
|
||||
|
||||
uint64_t FailedContiguousInvalidRequest;
|
||||
uint64_t FailedContiguousReserveDenied;
|
||||
uint64_t FailedContiguousNoRun;
|
||||
|
||||
uint64_t ReclaimAttempts;
|
||||
uint64_t ReclaimPagesRequested;
|
||||
uint64_t ReclaimPagesSucceeded;
|
||||
uint64_t ReclaimPagesFailed;
|
||||
uint64_t ReclaimReentrantSkips;
|
||||
} SYS_PFN_STATS;
|
||||
|
||||
typedef struct SYS_VAD_STATS {
|
||||
uint64_t ResolveFaultCalls;
|
||||
uint64_t ResolvedFaults;
|
||||
uint64_t FailedFaults;
|
||||
uint64_t ProtectionFaults;
|
||||
uint64_t NoVadFaults;
|
||||
uint64_t UncommittedFaults;
|
||||
uint64_t NoAccessFaults;
|
||||
uint64_t DemandZeroPages;
|
||||
uint64_t ZeroPageMaps;
|
||||
uint64_t ZeroPageCowSplits;
|
||||
uint64_t CowFaults;
|
||||
uint64_t CowPagesCopied;
|
||||
uint64_t CowViewsCreated;
|
||||
uint64_t CowPagesShared;
|
||||
uint64_t EnsureResidentCalls;
|
||||
uint64_t EnsureResidentPages;
|
||||
uint64_t AlreadyResidentPages;
|
||||
uint64_t FileBackedFaults;
|
||||
uint64_t FileBackedReads;
|
||||
uint64_t FileBackedReadFailures;
|
||||
uint64_t FileBackedDiscards;
|
||||
uint64_t FileBackedSharedWritableFaults;
|
||||
uint64_t FileBackedDirtyFaults;
|
||||
uint64_t FileBackedDirtySyncs;
|
||||
uint64_t ImageBackedFaults;
|
||||
uint64_t ImageBackedZeroFaults;
|
||||
uint64_t ImageBackedPrivateFaults;
|
||||
uint64_t ImageFixupPrivateCalls;
|
||||
uint64_t ImageFixupPrivatePages;
|
||||
uint64_t SwapPageOuts;
|
||||
uint64_t SwapPageIns;
|
||||
} SYS_VAD_STATS;
|
||||
|
||||
|
||||
typedef struct SYS_FILE_CACHE_STATS {
|
||||
uint64_t Lookups;
|
||||
uint64_t Hits;
|
||||
uint64_t Misses;
|
||||
uint64_t Loads;
|
||||
uint64_t LoadFailures;
|
||||
uint64_t RaceDiscards;
|
||||
uint64_t InflightWaits;
|
||||
uint64_t Invalidations;
|
||||
uint64_t DirtyPages;
|
||||
uint64_t MaxDirtyPages;
|
||||
uint64_t DirtyMarks;
|
||||
uint64_t WritebackRequests;
|
||||
uint64_t WritebackPages;
|
||||
uint64_t WritebackBytes;
|
||||
uint64_t WritebackFailures;
|
||||
uint64_t FlushFileCalls;
|
||||
uint64_t FlushFileFailures;
|
||||
uint64_t MappedDirtySyncs;
|
||||
uint64_t MappedDirtyPages;
|
||||
uint64_t Drops;
|
||||
uint64_t DropFailures;
|
||||
uint64_t StandbyTransitions;
|
||||
uint64_t StandbyHits;
|
||||
uint64_t ReadAheadRequests;
|
||||
uint64_t ReadAheadPagesRequested;
|
||||
uint64_t ReadAheadPagesQueued;
|
||||
uint64_t ReadAheadPagesLoaded;
|
||||
uint64_t ReadAheadPagesSkipped;
|
||||
uint64_t ReadAheadFailures;
|
||||
uint64_t ReadAheadPagesThrottled;
|
||||
uint64_t MaxReadAheadPagesPerRequest;
|
||||
uint64_t BatchReads;
|
||||
uint64_t BatchPagesRequested;
|
||||
uint64_t BatchPagesLoaded;
|
||||
uint64_t MaxBatchPagesRequested;
|
||||
uint64_t MaxBatchPagesLoaded;
|
||||
uint64_t ResidentPages;
|
||||
uint64_t ActivePages;
|
||||
uint64_t StandbyPages;
|
||||
uint64_t MaxResidentPages;
|
||||
} SYS_FILE_CACHE_STATS;
|
||||
|
||||
typedef struct SYS_FILESYSTEM_STATS {
|
||||
uint64_t PathLookups;
|
||||
uint64_t PathCacheHits;
|
||||
uint64_t PathCacheMisses;
|
||||
uint64_t PathCacheStores;
|
||||
uint64_t PathCacheInvalidations;
|
||||
uint64_t PathCacheGeneration;
|
||||
uint64_t DirectorySearches;
|
||||
uint64_t DirectoryClustersRead;
|
||||
uint64_t DirectoryEntriesScanned;
|
||||
uint64_t FatChainCacheLookups;
|
||||
uint64_t FatChainCacheHits;
|
||||
uint64_t FatChainCacheMisses;
|
||||
uint64_t FatChainCacheStores;
|
||||
uint64_t FatChainCacheInvalidations;
|
||||
uint64_t FatChainWalkSteps;
|
||||
uint64_t DataReadRuns;
|
||||
uint64_t DataReadSectors;
|
||||
uint64_t DataReadRunMerges;
|
||||
uint64_t MaxDataReadSpanSectors;
|
||||
} SYS_FILESYSTEM_STATS;
|
||||
|
||||
typedef struct SYS_DISK_STATS {
|
||||
uint64_t RegisteredDisks;
|
||||
uint64_t ReadRequests;
|
||||
uint64_t ReadSectors;
|
||||
uint64_t WriteRequests;
|
||||
uint64_t WriteSectors;
|
||||
uint64_t MaxReadSectors;
|
||||
uint64_t MaxWriteSectors;
|
||||
uint64_t ReadaheadHits;
|
||||
uint64_t ReadaheadMisses;
|
||||
uint64_t ReadaheadStores;
|
||||
uint64_t ReadaheadInvalidations;
|
||||
uint64_t ReadaheadBytesServed;
|
||||
uint64_t ReadaheadSectorsLoaded;
|
||||
uint64_t ReadaheadSequentialDetections;
|
||||
uint64_t ReadaheadSuppressed;
|
||||
uint64_t ReadaheadAllocFailures;
|
||||
uint64_t ReadaheadReadFailures;
|
||||
uint64_t MaxReadaheadSectors;
|
||||
} SYS_DISK_STATS;
|
||||
|
||||
typedef struct SYS_SWAP_STATS {
|
||||
uint64_t Enabled;
|
||||
uint64_t TotalSlots;
|
||||
uint64_t UsedSlots;
|
||||
uint64_t FreeSlots;
|
||||
uint64_t HighWaterSlots;
|
||||
uint64_t PageOuts;
|
||||
uint64_t PageIns;
|
||||
uint64_t PageOutFailures;
|
||||
uint64_t PageInFailures;
|
||||
uint64_t SlotAllocations;
|
||||
uint64_t SlotFrees;
|
||||
uint64_t SlotAllocationFailures;
|
||||
} SYS_SWAP_STATS;
|
||||
|
||||
typedef struct SYS_PTE_STATS {
|
||||
uint64_t MapCalls;
|
||||
uint64_t MapFailures;
|
||||
uint64_t UnmapCalls;
|
||||
uint64_t UnmapFailures;
|
||||
uint64_t ProtectCalls;
|
||||
uint64_t ProtectFailures;
|
||||
uint64_t QueryCalls;
|
||||
uint64_t QueryFailures;
|
||||
uint64_t QueryByPurpose[6];
|
||||
uint64_t QueryFailuresByPurpose[6];
|
||||
uint64_t TranslateCalls;
|
||||
uint64_t LocalFlushes;
|
||||
uint64_t GlobalFlushes;
|
||||
uint64_t ShootdownRequests;
|
||||
uint64_t ShootdownTargetCpus;
|
||||
uint64_t ShootdownSkippedNoTargets;
|
||||
uint64_t ShootdownAcks;
|
||||
uint64_t ShootdownTimeouts;
|
||||
uint64_t NewMappingNoFlushes;
|
||||
uint64_t ReplacedMappingFlushes;
|
||||
uint64_t PageTablePagesAllocated;
|
||||
uint64_t CurrentLeafMappings;
|
||||
} SYS_PTE_STATS;
|
||||
|
||||
#define SYS_CPU_FLAG_PRESENT 0x00000001u
|
||||
#define SYS_CPU_FLAG_STARTED 0x00000002u
|
||||
#define SYS_CPU_FLAG_PARKED 0x00000004u
|
||||
|
||||
Reference in new issue
Block a user