feat: enable guest compilation for aarch64#1297
Open
ludfjig wants to merge 4 commits intohyperlight-dev:mainfrom
Open
feat: enable guest compilation for aarch64#1297ludfjig wants to merge 4 commits intohyperlight-dev:mainfrom
ludfjig wants to merge 4 commits intohyperlight-dev:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enable building the guest runtime for aarch64 by moving x86_64-specific code behind architecture gates and adding aarch64 stub modules.
Changes:
- Added aarch64 arch module selection and stub implementations (
unimplemented!()) to allow compilation. - Moved
out32into an architecture-specific module and gated x86_64-only modules/features. - Updated
build.rsto skip C/musl compilation on non-x86_64 targets.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hyperlight_guest_tracing/src/lib.rs | Gate invariant TSC module to x86_64 only. |
| src/hyperlight_guest_bin/src/lib.rs | Select aarch64 arch module; gate x86_64-only modules and mem profiling paths. |
| src/hyperlight_guest_bin/src/arch/aarch64/mod.rs | Add aarch64 guest entrypoint/dispatch stubs. |
| src/hyperlight_guest_bin/build.rs | Skip C/musl build and header copying on non-x86_64 targets. |
| src/hyperlight_guest/src/prim_alloc.rs | Add aarch64 arch file selection for primitive allocator. |
| src/hyperlight_guest/src/layout.rs | Add aarch64 arch file selection for layout constants/functions. |
| src/hyperlight_guest/src/exit.rs | Extract out32 into arch modules; add aarch64 exit stub. |
| src/hyperlight_guest/src/arch/amd64/exit.rs | New x86_64 implementation of out32 (moved from exit.rs). |
| src/hyperlight_guest/src/arch/aarch64/prim_alloc.rs | Add aarch64 allocator stub. |
| src/hyperlight_guest/src/arch/aarch64/layout.rs | Add aarch64 layout placeholders + unimplemented scratch helpers. |
| src/hyperlight_guest/src/arch/aarch64/exit.rs | Add aarch64 out32 stub. |
Extract the out32 VM exit function from exit.rs into arch/amd64/exit.rs. exit.rs now delegates to the arch module via cfg_attr, keeping arch-independent code (outb, abort, debug_print) in the shared file. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
The invariant_tsc module uses core::arch::x86_64 intrinsics (CPUID, RDTSC) which are not available on other architectures. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
- Gate paging and exception modules on target_arch = x86_64 - Gate ProfiledLockedHeap (uses x86 out asm) on x86_64 - Skip musl/printf C compilation in build.rs on non-x86_64 Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Add aarch64 arch modules with unimplemented!() stubs: - hyperlight-guest: layout, prim_alloc, exit modules - hyperlight-guest-bin: dispatch and entrypoint stubs Update cfg_attr paths in layout.rs and prim_alloc.rs to include aarch64. All stubs panic at runtime — no aarch64 guest functionality is implemented yet. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
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.
Enable guest compilation for aarch64: