1#![doc(
2 html_favicon_url = "https://media.githubusercontent.com/media/hermit-os/uhyve/main/img/uhyve_128.png"
3)]
4#![doc(
5 html_logo_url = "https://media.githubusercontent.com/media/hermit-os/uhyve/main/img/uhyve_512.png"
6)]
7#![cfg_attr(not(feature = "std"), no_std)]
13
14macro_rules! into_hypercall_addresses {
20 (@internal $Self:ty; $name1:ident => $name2:ident) => { <$Self>::$name2 };
21 (@internal $Self:ty; $name1:ident) => { <$Self>::$name1 };
22
23 (
24 impl From<$hc:ident> for $hca:ty {
25 match {
26 $( $name1:ident $(=> $name2:ident)? ),*
27 $(,)?
28 }
29 }
30 ) => {
31 impl From<$hc<'_>> for $hca {
32 fn from(value: $hc<'_>) -> Self {
33 match value {
34 $($hc::$name1 { .. } => into_hypercall_addresses!(@internal Self; $name1 $(=> $name2)?)),*
35 }
36 }
37 }
38 impl From<&$hc<'_>> for $hca {
39 fn from(value: &$hc<'_>) -> Self {
40 match value {
41 $($hc::$name1 { .. } => into_hypercall_addresses!(@internal Self; $name1 $(=> $name2)?)),*
42 }
43 }
44 }
45 }
46}
47
48mod parameters;
50
51pub mod v1;
53pub mod v2;
55
56pub use memory_addresses::{PhysAddr as GuestPhysAddr, VirtAddr as GuestVirtAddr};
57
58#[cfg(not(target_pointer_width = "64"))]
59compile_error!("Using uhyve-interface on a non-64-bit system is not (yet?) supported");
60
61pub const UHYVE_INTERFACE_VERSION: u32 = 2;