From cc90b34fdb3b23bed65b3af41a190d18688a63b6 Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Sat, 15 Aug 2026 21:18:03 +0200 Subject: [PATCH] cleanup: update stale comments --- kernel/src/Api/Filesystem.hpp | 6 +++--- kernel/src/Api/Syscall.hpp | 2 +- kernel/src/Sched/Scheduler.hpp | 7 ++++--- programs/include/Api/Syscall.hpp | 2 +- template/sysroot/include/Api/Syscall.hpp | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/src/Api/Filesystem.hpp b/kernel/src/Api/Filesystem.hpp index 7671901..4589c8d 100644 --- a/kernel/src/Api/Filesystem.hpp +++ b/kernel/src/Api/Filesystem.hpp @@ -62,9 +62,9 @@ namespace montauk::abi { if (proc == nullptr) return -1; // Use a rotating ring of scratch pages below the heap instead of - // bumping heapNext on every call. This keeps repeated directory scans - // from leaking user heap space while still allowing nested callers to - // hold multiple readdir results at once. + // extending the heap high-water mark on every call. This keeps repeated + // directory scans from consuming user heap address space while still + // allowing nested callers to hold multiple readdir results at once. uint32_t slot = proc->readdirCursor % Sched::UserReadDirSlots; proc->readdirCursor = (slot + 1) % Sched::UserReadDirSlots; diff --git a/kernel/src/Api/Syscall.hpp b/kernel/src/Api/Syscall.hpp index ca91130..f0ec4dd 100644 --- a/kernel/src/Api/Syscall.hpp +++ b/kernel/src/Api/Syscall.hpp @@ -617,7 +617,7 @@ namespace montauk::abi { uint8_t state; // 0=Free, 1=Ready, 2=Running, 3=Blocked, 4=Terminated uint8_t _pad[3]; char name[64]; - uint64_t heapUsed; // heapNext - UserHeapBase (bytes) + uint64_t heapUsed; // Distance from UserHeapBase to high-water mark uint64_t cpuTimeMs; // accumulated scheduler runtime }; diff --git a/kernel/src/Sched/Scheduler.hpp b/kernel/src/Sched/Scheduler.hpp index d2701e8..0965ad6 100644 --- a/kernel/src/Sched/Scheduler.hpp +++ b/kernel/src/Sched/Scheduler.hpp @@ -80,7 +80,7 @@ namespace Sched { uint64_t pml4Phys; // Physical address of per-process PML4 uint64_t kernelStackTop; // Top of kernel stack (for TSS RSP0 / SYSCALL) uint64_t userStackTop; // User-space stack top - uint64_t heapNext; // Simple bump allocator for user heap + uint64_t heapNext; // High-water mark of the user-heap address space uint32_t readdirCursor; // Next SYS_READDIR scratch slot char args[4096]; // Command-line arguments (set by parent via Spawn) char environment[EnvironmentBytes]; // NUL-separated NAME=VALUE entries @@ -273,8 +273,9 @@ namespace Sched { // Per-process allocated page count (tracked by Heap syscalls, separate from Process struct) inline uint64_t g_allocatedPages[MaxProcesses] = {}; - // One bit per page in the bounded userspace heap. Unlike heapNext, this - // makes virtual ranges reusable after unmap and failed reservations. + // One bit per page in the bounded userspace heap. This is the authoritative + // allocation state; unlike heapNext, it makes virtual ranges reusable after + // unmap and failed reservations. inline uint64_t g_userHeapPageMap[MaxProcesses][UserHeapBitmapWords] = {}; } diff --git a/programs/include/Api/Syscall.hpp b/programs/include/Api/Syscall.hpp index 10a9d65..e481169 100644 --- a/programs/include/Api/Syscall.hpp +++ b/programs/include/Api/Syscall.hpp @@ -706,7 +706,7 @@ namespace montauk::abi { uint8_t state; // 0=Free, 1=Ready, 2=Running, 3=Blocked, 4=Terminated uint8_t _pad[3]; char name[64]; - uint64_t heapUsed; // heapNext - UserHeapBase (bytes) + uint64_t heapUsed; // Distance from UserHeapBase to high-water mark uint64_t cpuTimeMs; // accumulated scheduler runtime }; diff --git a/template/sysroot/include/Api/Syscall.hpp b/template/sysroot/include/Api/Syscall.hpp index a49cc99..36e946d 100644 --- a/template/sysroot/include/Api/Syscall.hpp +++ b/template/sysroot/include/Api/Syscall.hpp @@ -701,7 +701,7 @@ namespace montauk::abi { uint8_t state; // 0=Free, 1=Ready, 2=Running, 3=Blocked, 4=Terminated uint8_t _pad[3]; char name[64]; - uint64_t heapUsed; // heapNext - UserHeapBase (bytes) + uint64_t heapUsed; // Distance from UserHeapBase to high-water mark uint64_t cpuTimeMs; // accumulated scheduler runtime };