Skip to content

Conversation

@JonasKruckenberg
Copy link
Owner

This PR extracts out the pretty substantial kmem-core component from the loader and kernel responsible for hardware-side address space management. This PR does not replace the loader or kernels implementation yet, that is left for a follow-up.

What this implements:

  • MemoryMode abstracts the page table shape (number of levels, number of entries per level, which levels support leaves)
  • Arch provides the internal architecture-specific interface.
  • RiscV64, RISCV_SV39, RISCV_SV48, and RISCV_SV57 provide RISC-V Arch implementations and MemoryMode definitions.
  • EmulateArch provides an emulator parameterized by an inner Arch impl that can be used in tests.
  • src/bootstrap implements address space bootstrapping for use in the loader.
  • AddressSpace is the main type of the crate, it represents an hardware address space.
    • AddressSpace::map_contiguous maps a contiguous range of physical addresses at a virtual address.
    • AddressSpace::remap_contiguous remaps a virtual address range
    • AddressSpace::set_attributes updates the attributes for a virtual address range
    • AddressSpace::unmap unmaps a virtual address range.

@JonasKruckenberg JonasKruckenberg force-pushed the jonas/feat-kmem-core branch 4 times, most recently from 6dcf961 to 9d231e0 Compare November 6, 2025 20:43
hardware address space

chore: rename to kmem-core

feat(kmem-core): ASID type

feat(kmem-core): interface for architecture-specific functionality

This change (re)-introduces the `Arch` trait defining the interface that architecture-specific modules in the `arch/` module must implement.

feat(kmem-core): memory mode abstraction

feat(kmem-core): `FrameAllocator` trait

feat(kmem-core): riscv64 architecture implementation

feat(kmem-core): test emulation support

feat(kmem-core): flush type

feat(kmem-core): implement AddressSpace::lookup

feat(kmem-core): implement `AddressSpace::set_attributes`

feat(kmem-core): implement `AddressSpace::remap`

hardware address space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants