Skip to content

feat: enable guest compilation for aarch64#1297

Open
ludfjig wants to merge 4 commits intohyperlight-dev:mainfrom
ludfjig:aarch64_guest
Open

feat: enable guest compilation for aarch64#1297
ludfjig wants to merge 4 commits intohyperlight-dev:mainfrom
ludfjig:aarch64_guest

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Mar 10, 2026

Enable guest compilation for aarch64:

  • Extract x86_64-specific out32 into arch module
  • Gate x86_64-only modules (paging, exception, invariant_tsc, musl)
  • Add aarch64 arch stubs with unimplemented!()

@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Mar 10, 2026
@ludfjig ludfjig changed the title Aarch64 guest allow Aarch64 compilation for guest Mar 10, 2026
@ludfjig ludfjig requested a review from Copilot March 10, 2026 20:02
Copy link
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

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 out32 into an architecture-specific module and gated x86_64-only modules/features.
  • Updated build.rs to 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.

@ludfjig ludfjig changed the title allow Aarch64 compilation for guest feat: enable guest compilation for aarch64 Mar 10, 2026
ludfjig added 4 commits March 10, 2026 13:42
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>
@ludfjig ludfjig marked this pull request as ready for review March 10, 2026 21:06
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.

2 participants