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

@@ -0,0 +1,93 @@
// Native surface smoke test.
// Verifies that process-private surface handles can be created, mapped, queried, presented, and closed.
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <ntlite/syscall.h>
#define SURFACE_W 64u
#define SURFACE_H 48u
static void print(const char* s) {
SYS_WRITE_CONSOLE_REQUEST req = { SysSvFromCstr(s) };
SysWriteConsole(&req);
}
static void print_u64(uint64_t v) {
char buf[32];
int i = 0;
if (v == 0) { print("0"); return; }
while (v && i < (int)sizeof(buf)) {
buf[i++] = (char)('0' + (v % 10));
v /= 10;
}
while (i--) {
char c = buf[i];
SYS_WRITE_CONSOLE_REQUEST req = { SysSvFromParts(&c, 1) };
SysWriteConsole(&req);
}
}
static void exit_now(int code) {
for (;;) SysExitProcess(code);
}
static void fail(const char* msg) {
print("surface_smoke: ");
print(msg);
print("\n");
exit_now(1);
}
static void fail_status(const char* what, uint32_t status) {
print("surface_smoke: ");
print(what);
print(" failed status=");
print_u64(status);
print("\n");
exit_now(1);
}
int main(void) {
print("surface_smoke: start\n");
uint32_t surface = 0;
uint32_t s = SysCreateSurface(SURFACE_W, SURFACE_H, SYS_SURFACE_FORMAT_XRGB8888,
SYS_SURFACE_FLAG_NONE, &surface);
if (s != SYS_STATUS_SUCCESS) fail_status("create surface", s);
if (!surface) fail("surface handle is zero");
void* base = 0;
uint32_t pitch = 0;
s = SysMapSurface(surface, &base, &pitch);
if (s != SYS_STATUS_SUCCESS) fail_status("map surface", s);
if (!base || pitch < SURFACE_W * sizeof(uint32_t)) fail("invalid mapping");
SYS_SURFACE_DESC desc;
memset(&desc, 0, sizeof(desc));
s = SysQuerySurface(surface, &desc);
if (s != SYS_STATUS_SUCCESS) fail_status("query surface", s);
if (desc.Width != SURFACE_W || desc.Height != SURFACE_H) fail("query dimensions mismatch");
if (desc.PitchBytes != pitch || desc.Format != SYS_SURFACE_FORMAT_XRGB8888) fail("query metadata mismatch");
if (desc.Base != base) fail("query base mismatch");
uint8_t* rows = (uint8_t*)base;
for (uint32_t y = 0; y < SURFACE_H; ++y) {
uint32_t* row = (uint32_t*)(rows + (size_t)y * pitch);
for (uint32_t x = 0; x < SURFACE_W; ++x)
row[x] = 0x00202020u + ((x & 0xffu) << 16) + ((y & 0xffu) << 8);
}
DISPLAY_RECT rect = { 0, 0, (int32_t)SURFACE_W, (int32_t)SURFACE_H };
s = SysPresentSurface(surface, &rect, 1);
if (s != SYS_STATUS_SUCCESS) fail_status("present surface", s);
s = SysPresentSurface(surface, 0, 0);
if (s != SYS_STATUS_SUCCESS) fail_status("present full surface", s);
SysCloseHandle(surface);
print("surface_smoke: PASS\n");
exit_now(0);
return 0;
}