ahrightos-memory 0.1.0

Portable memory primitives for the AhRightOS teaching kernel.
Documentation
  • Coverage
  • 4.21%
    4 out of 95 items documented0 out of 71 items with examples
  • Size
  • Source code size: 27.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 890.1 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1s Average build duration of successful builds.
  • all releases: 1s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nullptr4

ahrightos-memory

ahrightos-memory contains the portable memory-management primitives used by the AhRightOS teaching kernel: address wrappers, Sv39 page-table entries, page tables, physical frames, and the simple frame allocator.

The crate is no_std outside tests and is designed to be consumed by the RISC-V kernel crate as well as by host-side unit and integration tests.

Incremental VM contracts

The portable crate now includes a small, testable virtual-memory region model:

  • VmRegion describes an mmap-like virtual range, permissions, and kind (Anonymous, FileBacked, grow-down Stack, SwapBacked).
  • VmRegionTable rejects overlapping regions, finds regions by fault address, tracks lazy per-page commitment with a bounded bitmap, and can grow stack reservations down within a configured maximum.
  • This is intentionally bookkeeping only. Actual page-fault dispatch, file page-in, and swap I/O remain kernel integration steps, but the invariants are now enforced in a host-testable no_std component.
flowchart LR
    Kernel[ahrightos-kernel] --> Memory[ahrightos-memory]
    Memory --> Addr[VirtAddr / PhysAddr]
    Memory --> PageTable[PageTable / PageTableEntry]
    Memory --> Alloc[SimpleFrameAllocator]
    Memory --> VM[VmRegion / VmRegionTable]