CrisOS v2 uses a simple, deterministic memory model suited to its educational 32-bit i386 environment. There is no virtual memory, no paging, and no free list — just a bump allocator backed by a fixed static array. Every allocation advances a single offset pointer and nothing is ever reclaimed. This design makes memory behavior fully predictable and easy to reason about, at the cost of a hard upper bound on total dynamic allocation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CRISTOP-bot/cris-os-v2/llms.txt
Use this file to discover all available pages before exploring further.
Kernel Load Address
The linker script places the kernel image starting at physical address0x00100000 (1 MB):
Stack
The kernel stack is a static 8 KB region declared in the.bss section of boot/boot.S:
$stack_top into %esp and immediately 16-byte-aligns the pointer (and $-16, %esp) to satisfy the System V i386 ABI calling convention before invoking kmain. Because the region lives in .bss it is guaranteed to be zero-filled at load time.
Stack base
stack — lowest address of the 8192-byte region, declared with .lcommStack top
stack_top = stack + 8192 — initial %esp value; grows downward toward stackBump Heap Allocator
Dynamic memory in CrisOS v2 is managed by a minimal bump allocator insrc/memory.c. The entire heap is a single 64 × 1024 = 65 536 byte static array:
- 4-byte alignment — every requested size is rounded up to the next multiple of 4 before the pointer is advanced, ensuring all returned pointers are naturally aligned for 32-bit accesses.
- No fragmentation tracking — the bump pointer only moves forward; previously allocated blocks are never reused.
kfreeis a no-op — the function accepts a pointer argument (to satisfy callers that expect a standardfree-style interface) but does nothing with it.- Exhaustion returns NULL — if
heap_used + size > 65536,kmallocreturns0(NULL). Callers are responsible for checking the return value.
VFS Data Store
The Virtual File System layer (src/vfs.c) maintains a separate 16 KB flat buffer for the writable content of in-memory files:
data_store by advancing data_used. Like kmalloc, allocations from the data store are permanent — there is no mechanism to reclaim space once content has been written.