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:
maksw committed 2026-06-20 13:17:39 +02:00
1 parent 61ec2442eb
commit 2c4a68a75f
114 files changed
+18069 -2620

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
#include <ntlite/syscall.h>
static int u64_to_string(uint64_t n, char* buf) {
int i = 0;
if (n == 0) {
buf[i++] = '0';
buf[i] = '\0';
return i;
}
char rev[24];
int r_idx = 0;
while (n > 0) {
rev[r_idx++] = (char)('0' + (n % 10));
n /= 10;
}
while (r_idx > 0) {
buf[i++] = rev[--r_idx];
}
buf[i] = '\0';
return i;
}
int main(void) {
SYS_CONSOLE_INFO console;
SYS_MEMORY_STATUS mem;
char metricsBuf[128];
while (true) {
if (SysGetConsoleInfo(&console) == SYS_STATUS_SUCCESS &&
SysGetMemoryStatus(&mem) == SYS_STATUS_SUCCESS) {
// If the system isn't reporting columns correctly, default to a safe standard width
int columns = (console.Columns > 0) ? (int)console.Columns : 80;
char freeStr[24], poolStr[24], heapStr[24];
u64_to_string(mem.FreePhysicalBytes / 1024u, freeStr);
u64_to_string(mem.KernelPoolBytes / 1024u, poolStr);
u64_to_string(mem.UserHeapBytes / 1024u, heapStr);
metricsBuf[0] = '\0';
strcat(metricsBuf, "[ Free: ");
strcat(metricsBuf, freeStr);
strcat(metricsBuf, "K | Pool: ");
strcat(metricsBuf, poolStr);
strcat(metricsBuf, "K | Heap: ");
strcat(metricsBuf, heapStr);
strcat(metricsBuf, "K ]");
size_t textLen = strlen(metricsBuf);
int targetX = columns - (int)textLen;
int targetY = 0;
if (targetX >= 0) {
size_t written = 0;
// Loop through the string and use the console's dedicated text filling API
// This utilizes the console's native font configuration instead of drawing raw screen bits
for (size_t i = 0; i < textLen; i++) {
SysFillConsoleCharacter(metricsBuf[i], targetX + (int)i, targetY, 1, &written);
}
}
}
SysSleep(500);
}
return 0;
}