Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extracts out the pretty substantial
kmem-corecomponent 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:
MemoryModeabstracts the page table shape (number of levels, number of entries per level, which levels support leaves)Archprovides the internal architecture-specific interface.RiscV64,RISCV_SV39,RISCV_SV48, andRISCV_SV57provide RISC-VArchimplementations andMemoryModedefinitions.EmulateArchprovides an emulator parameterized by an innerArchimpl that can be used in tests.src/bootstrapimplements address space bootstrapping for use in the loader.AddressSpaceis the main type of the crate, it represents an hardware address space.AddressSpace::map_contiguousmaps a contiguous range of physical addresses at a virtual address.AddressSpace::remap_contiguousremaps a virtual address rangeAddressSpace::set_attributesupdates the attributes for a virtual address rangeAddressSpace::unmapunmaps a virtual address range.