ferros icon indicating copy to clipboard operation
ferros copied to clipboard

VSpace: Unify the uses of ScratchRegion, ReservedRegion, and MappedRegion

Open pittma opened this issue 5 years ago • 1 comments

These three types grew at distinct times in the development of VSpace 2: The Address Space Odyssey and they could be contracted into a single type which serves the needs of each use case.

This is a follow up to #9.

pittma avatar Jun 24 '19 21:06 pittma

If MemoryRegion learns how to unmap itself, we can replace the current uses of ScratchRegion with an exclusive MemoryRegion which gets unmapped after it's been used locally. ELF setup, however, has a special case—it needs pages. Therefore we create a ScratchRegion-like type which aliases the VSpace capability and has ownership of a single page's worth of address space. It uses the ReservedRegion mechanics to set up the intermediate paging structures, then takes MemoryRegions of size PageBits into a temporarily_map function a lá ScratchRegion::temporarily_map_region.

pittma avatar Aug 06 '19 16:08 pittma