Skip to content

feat(vmem): fold space_aware_map dispatch#1419

Open
andreiltd wants to merge 1 commit intohyperlight-dev:mainfrom
andreiltd:issue-1409
Open

feat(vmem): fold space_aware_map dispatch#1419
andreiltd wants to merge 1 commit intohyperlight-dev:mainfrom
andreiltd:issue-1409

Conversation

@andreiltd
Copy link
Copy Markdown
Member

Fixes: #1409

@andreiltd andreiltd added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Apr 27, 2026
Fixes: hyperlight-dev#1409

Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SpaceReferenceMapping to be per-architecture (with Void used on arches that never emit AnotherSpace), and replaces i686’s generic depth with an i686-specific SharedTableLevel enum.
  • Changes vmem::space_aware_map to take SpaceAwareMapping and dispatch internally to either arch::map or arch::link_shared_table.
  • Updates snapshot rebuild code to call the unified vmem::space_aware_map API for both ThisSpace and AnotherSpace cases.

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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vmem: make SpaceReferenceMapping per-arch and fold space_aware_map dispatch

2 participants