Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fb1964e
[nix] Make devShells.default work for more than just x86_64-linux
syntactically May 26, 2026
46d81e6
Only pass `page_size` to `HyperlightVm` once
syntactically May 10, 2026
1ba1d5e
[aarch64] Fix stub compilation
syntactically May 10, 2026
6f4dfe3
[hyperlight_libc] Support building picolibc for aarch64
syntactically May 10, 2026
5175050
[simpleguest] cfg-gate functions that do not compile on aarch64
syntactically May 10, 2026
0df73e7
Rename MAX_{GPA,GVA} to SCRATCH_TOP_{GPA,GVA}
syntactically May 18, 2026
89da231
Justfile: add support for compiling for aarch64
syntactically May 23, 2026
4b8e50b
HyperlightVm: allow hypervisor backends to implement reset_vcpu
syntactically May 23, 2026
fbeba94
[hyperlight_guest_bin] Make `init_stack` architecture-independent
syntactically May 23, 2026
7583097
Extract UpdateParentTable from amd64 arch-specific to generic vmem code
syntactically May 26, 2026
bcd318f
aarch64: add memory layout
syntactically May 26, 2026
be9507f
hyperlight_guest_bin: move exposed virtual memory operations to arch-…
syntactically May 26, 2026
3814ae4
aarch64: add virtual memory operations
syntactically May 26, 2026
ac1f81b
[hyperlight_host] aarch64: add basic register handling for KVM
syntactically May 26, 2026
92b2662
[hyperlight_guest_bin] aarch64: support MMIO exits
syntactically May 26, 2026
e308278
[hyperlight_guest] aarch64: Implement simple physical page allocator
syntactically May 26, 2026
9497275
[hyperlight_guest_bin] aarch64: add basic exception handlers
syntactically May 26, 2026
1c1aef8
[hyperlight_guest_bin] aarch64: add initialisation/dispatch assembly …
syntactically May 26, 2026
3c184cd
[hyperlight_host] aarch64: initial KVM implementation
syntactically May 26, 2026
d34cf9c
[tests] aarch64: remove amd64-isms from enabled tests
syntactically May 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ export CROSS_CONTAINER_GID := if path_exists("/dev/kvm") == "true" { kvm-gid } e
root := justfile_directory()

default-target := "debug"
simpleguest_source := "src/tests/rust_guests/simpleguest/target/x86_64-hyperlight-none"
dummyguest_source := "src/tests/rust_guests/dummyguest/target/x86_64-hyperlight-none"
witguest_source := "src/tests/rust_guests/witguest/target/x86_64-hyperlight-none"
hyperlight-target-arch := env("HYPERLIGHT_TARGET", arch())
hyperlight-target := if hyperlight-target-arch == "x86_64" { "x86_64-hyperlight-none" } else if hyperlight-target-arch == "aarch64" { "aarch64-hyperlight-none" } else { error("Unsupported architecture: " + arch()) }
simpleguest_source := "src/tests/rust_guests/simpleguest/target/" + hyperlight-target
dummyguest_source := "src/tests/rust_guests/dummyguest/target/" + hyperlight-target
witguest_source := "src/tests/rust_guests/witguest/target/" + hyperlight-target
rust_guests_bin_dir := "src/tests/rust_guests/bin"

################
Expand Down
5 changes: 3 additions & 2 deletions c.just
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
mkdir := if os() == "windows" { "mkdir -f -p" } else { "mkdir -p"}

# Elf options
hyperlight-target-c := if hyperlight-target-arch == "x86_64" { "x86_64-unknown-linux-none" } else if hyperlight-target-arch == "aarch64" { "aarch64-unknown-linux-none" } else { error("Unsupported architecture: " + hyperlight-target-arch) }
# We don't support stack protectors at the moment, but Arch Linux clang auto-enables them for -linux platforms, so explicitly disable them.
c-compile-options-elf := '-nostdlibinc -H --target=x86_64-unknown-linux-none -fno-stack-protector -fstack-clash-protection -mstack-probe-size=4096 -fPIC'
c-compile-options-elf := f'-nostdlibinc -H --target={{hyperlight-target-c}} -fno-stack-protector -fstack-clash-protection -mstack-probe-size=4096 -fPIC'
c-include-flags-elf := "-I " + root / "src/hyperlight_guest_capi/include/" + " -I " + root / "src/hyperlight_libc/third_party/picolibc/libc/include/" + " -I " + root / "src/hyperlight_libc/third_party/picolibc/libc/stdio/" + " -I " + root / "src/hyperlight_libc/include/"
c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie --no-dynamic-linker'
c-flags-debug-elf := '-O0'
Expand All @@ -19,7 +20,7 @@ compile-c-guest target=default-target:

link-c-guest target=default-target:
# elf
cd src/tests/c_guests/c_simpleguest && ld.lld -o out/{{target}}/simpleguest {{c-linker-options-elf}} out/{{target}}/main.o -l hyperlight_guest_capi -L "{{justfile_directory()}}/target/x86_64-hyperlight-none/{{target}}"
cd src/tests/c_guests/c_simpleguest && ld.lld -o out/{{target}}/simpleguest {{c-linker-options-elf}} out/{{target}}/main.o -l hyperlight_guest_capi -L "{{justfile_directory()}}/target/{{hyperlight-target}}/{{target}}"

move-c-guests target=default-target:
# elf
Expand Down
6 changes: 6 additions & 0 deletions docs/paging-development-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,9 @@ below the exception stack within the scratch region.

Hyperlight unconditionally uses 48-bit virtual addresses (4-level
paging) and enables PAE. The guest is always entered in long mode.

## aarch64

Hyperlight unconditionally uses 48-bit virtual addresses. Hyperlight
presently only uses addresses in the lower (ttbr0) half of the address range.

26 changes: 14 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
toolchainVersionAttrs = args;
};
})) // {
targetPlatforms = [ "x86_64-linux" ];
targetPlatforms = [ "aarch64-linux" "x86_64-linux" ];
badTargetPlatforms = [ ];
};
overrideRustPkg = pkg: self.lib.makeOverridable (origArgs:
Expand All @@ -68,21 +68,21 @@
args = [ "-c" "declare > $out" ];
});
in {
shells.default = gcrootForShell devShells.x86_64-linux.default;
shells.x86_64-linux.default = gcrootForShell devShells.x86_64-linux.default;
shells.aarch64-linux.default = gcrootForShell devShells.aarch64-linux.default;
};
devShells.x86_64-linux.default =
let pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ (import (nixpkgs-mozilla + "/rust-overlay.nix")) overlays.fix-rust ];
};
in with pkgs; let
devShells = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: {
default = let pkgs = import nixpkgs {
inherit system;
overlays = [ (import (nixpkgs-mozilla + "/rust-overlay.nix")) overlays.fix-rust ];
}; in with pkgs; let
customisedRustChannelOf = args:
lib.flip builtins.mapAttrs (rustChannelOf args) (_: pkg: pkg.override {
targets = [
"x86_64-unknown-linux-gnu"
"x86_64-pc-windows-msvc" "x86_64-unknown-none"
"wasm32-wasip1" "wasm32-wasip2" "wasm32-unknown-unknown"
"i686-unknown-linux-gnu"
"i686-unknown-linux-gnu" "aarch64-unknown-none"
];
extensions = [ "rust-src" ] ++ (if args.channel == "nightly" then [ "miri-preview" ] else []);
});
Expand Down Expand Up @@ -227,10 +227,11 @@
src = fetchFromGitHub {
owner = "hyperlight-dev";
repo = "cargo-hyperlight";
tag = "v${version}";
hash = "sha256-xq4/c69N0wG/I8WOYVloo0J0JqoSIKiWWtECdSKrsxo=";
rev = "28ac7b57e8e7b83f80bd601f1fab334aa3ae6d4a";
hash = "sha256-a/mvPEDJycrCbmd826SmFdasE8BFtMkCsefCNR5JnkM=";
};
cargoHash = "sha256-muiMVrK1TydQiMitihfo7xYidqUIIQ+Hw3BIeo5rLFw=";
cargoHash = "sha256-wLapaao8qcB/toltV/xjQ7SXXcfh2J19nw6jWljmb2s=";
doCheck = false;
};
in (buildRustPackageClang (mkDerivationAttrs: {
pname = "hyperlight";
Expand Down Expand Up @@ -280,5 +281,6 @@
})).overrideAttrs(oA: {
hardeningDisable = [ "all" ];
});
});
};
}
23 changes: 16 additions & 7 deletions src/hyperlight_common/src/arch/aarch64/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// TODO(aarch64): change these, they are only provided in order to compile
pub const MAX_GVA: usize = 0xffff_ffff_ffff_efff;
pub const SNAPSHOT_PT_GVA_MIN: usize = 0xffff_8000_0000_0000;
pub const SNAPSHOT_PT_GVA_MAX: usize = 0xffff_80ff_ffff_ffff;
pub const MAX_GPA: usize = 0x0000_000f_ffff_ffff;
// TODO: consider using the upper half, like we do on x86;
// this would require enabling ttbr1
pub const SCRATCH_TOP_GVA: usize = 0x0000_ffff_ffff_dfff;
pub const SNAPSHOT_PT_GVA_MIN: usize = 0x0000_8000_0000_0000;
pub const SNAPSHOT_PT_GVA_MAX: usize = 0x0000_80ff_ffff_ffff;
pub const SCRATCH_TOP_GPA: usize = 0x0000_000f_ffff_efff;

pub fn min_scratch_size(_input_data_size: usize, _output_data_size: usize) -> usize {
unimplemented!("min_scratch_size")
pub const IO_PAGE_GVA: u64 = 0x0000_ffff_ffff_e000;
pub const IO_PAGE_GPA: u64 = 0x0000_000f_ffff_f000;

pub const fn io_page() -> Option<(crate::vmem::PhysAddr, crate::vmem::VirtAddr)> {
Some((IO_PAGE_GPA, IO_PAGE_GVA))
}

pub fn min_scratch_size(input_data_size: usize, output_data_size: usize) -> usize {
(input_data_size + output_data_size).next_multiple_of(crate::vmem::PAGE_SIZE)
+ 12 * crate::vmem::PAGE_SIZE
}
Loading
Loading