Skip to content

Commit 9420c72

Browse files
committed
feat: add aarch64 arch stubs for guest crates
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>
1 parent f67b03a commit 9420c72

File tree

6 files changed

+115
-0
lines changed

6 files changed

+115
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Copyright 2025 The Hyperlight Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// TODO(aarch64): implement VM exit mechanism (e.g. hvc instruction)
18+
19+
/// Trigger a VM exit sending a 32-bit value to the host on the given port.
20+
pub(crate) unsafe fn out32(_port: u16, _val: u32) {
21+
unimplemented!("aarch64 out32")
22+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Copyright 2025 The Hyperlight Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// TODO(aarch64): these values are placeholders copied from amd64
18+
pub const MAIN_STACK_TOP_GVA: u64 = 0xffff_ff00_0000_0000;
19+
pub const MAIN_STACK_LIMIT_GVA: u64 = 0xffff_fe00_0000_0000;
20+
21+
pub fn scratch_size() -> u64 {
22+
unimplemented!("aarch64 scratch_size")
23+
}
24+
25+
pub fn scratch_base_gpa() -> u64 {
26+
unimplemented!("aarch64 scratch_base_gpa")
27+
}
28+
29+
pub fn scratch_base_gva() -> u64 {
30+
unimplemented!("aarch64 scratch_base_gva")
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Copyright 2025 The Hyperlight Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// TODO(aarch64): implement real aarch64 page allocator
18+
19+
// There are no notable architecture-specific safety considerations
20+
// here, and the general conditions are documented in the
21+
// architecture-independent re-export in prim_alloc.rs
22+
#[allow(clippy::missing_safety_doc)]
23+
pub unsafe fn alloc_phys_pages(_n: u64) -> u64 {
24+
unimplemented!("aarch64 alloc_phys_pages")
25+
}

src/hyperlight_guest/src/layout.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
#[cfg_attr(target_arch = "x86_64", path = "arch/amd64/layout.rs")]
1818
#[cfg_attr(target_arch = "x86", path = "arch/i686/layout.rs")]
19+
#[cfg_attr(target_arch = "aarch64", path = "arch/aarch64/layout.rs")]
1920
mod arch;
2021

2122
pub use arch::{MAIN_STACK_LIMIT_GVA, MAIN_STACK_TOP_GVA};

src/hyperlight_guest/src/prim_alloc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
#[cfg_attr(target_arch = "x86_64", path = "arch/amd64/prim_alloc.rs")]
1818
#[cfg_attr(target_arch = "x86", path = "arch/i686/prim_alloc.rs")]
19+
#[cfg_attr(target_arch = "aarch64", path = "arch/aarch64/prim_alloc.rs")]
1920
mod arch;
2021

2122
/// Allocate n contiguous physical pages and return the physical
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2025 The Hyperlight Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// TODO(aarch64): implement aarch64 guest runtime
18+
19+
pub mod dispatch {
20+
/// Dispatch function pointer — set during initialisation and called
21+
/// by the host for each guest function invocation.
22+
#[unsafe(no_mangle)]
23+
pub extern "C" fn dispatch_function() {
24+
unimplemented!("aarch64 dispatch_function")
25+
}
26+
}
27+
28+
/// The entrypoint for the guest binary — called by the hypervisor.
29+
///
30+
/// On aarch64 this is a stub that will be implemented when the
31+
/// aarch64 hypervisor backend is ready.
32+
#[unsafe(no_mangle)]
33+
pub extern "C" fn entrypoint() -> ! {
34+
unimplemented!("aarch64 entrypoint")
35+
}

0 commit comments

Comments
 (0)