feat(vmem): fold space_aware_map dispatch#1419
Open
andreiltd wants to merge 1 commit intohyperlight-dev:mainfrom
Open
feat(vmem): fold space_aware_map dispatch#1419andreiltd wants to merge 1 commit intohyperlight-dev:mainfrom
andreiltd wants to merge 1 commit intohyperlight-dev:mainfrom
Conversation
Fixes: hyperlight-dev#1409 Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Hyperlight’s virtual-memory (vmem) multi-space page-table rebuild interface to be more architecture-specific and to centralize SpaceAwareMapping handling inside hyperlight_common::vmem, aligning with issue #1409.
Changes:
- Moves
SpaceReferenceMappingto be per-architecture (withVoidused on arches that never emitAnotherSpace), and replaces i686’s genericdepthwith an i686-specificSharedTableLevelenum. - Changes
vmem::space_aware_mapto takeSpaceAwareMappingand dispatch internally to eitherarch::maporarch::link_shared_table. - Updates snapshot rebuild code to call the unified
vmem::space_aware_mapAPI for bothThisSpaceandAnotherSpacecases.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hyperlight_host/src/sandbox/snapshot.rs | Updates snapshot rebuild loop to use the new unified vmem::space_aware_map API. |
| src/hyperlight_common/src/vmem.rs | Re-exports per-arch SpaceReferenceMapping and adds a wrapper space_aware_map that dispatches internally. |
| src/hyperlight_common/src/arch/i686/vmem.rs | Introduces SharedTableLevel + i686 SpaceReferenceMapping and renames the link operation to link_shared_table. |
| src/hyperlight_common/src/arch/amd64/vmem.rs | Defines SpaceReferenceMapping = Void and implements statically-unreachable link_shared_table for amd64. |
| src/hyperlight_common/src/arch/aarch64/vmem.rs | Defines SpaceReferenceMapping = Void and implements statically-unreachable link_shared_table for aarch64. |
| /// See [`walk_va_spaces`]: amd64 never emits `AnotherSpace`, so this | ||
| /// is unreachable in practice. It silently no-ops (rather than | ||
| /// panicking) to keep the architecture-independent re-export usable. | ||
| /// aarch64 never emits `AnotherSpace` entries, so [`SpaceReferenceMapping`] |
| /// is [`crate::vmem::Void`] making the `AnotherSpace` match arm statically unreachable. | ||
| pub type SpaceReferenceMapping = crate::vmem::Void; | ||
|
|
||
| /// Statically unreachable: amd64 never emits `AnotherSpace`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: #1409