hv1_hypercall/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Hyper-V hypercall parsing.
5//!
6//! This crate helps you implement handling for Hyper-V hypercalls issued by
7//! guest VMs. These are the hypercalls defined in the [Hypervisor Top Level
8//! Functional Specification][].
9//!
10//! Besides providing parsing of the core hypercall ABI, it also provides Rust
11//! traits for each supported hypercall.
12//!
13//! To use this crate, you provide access to the processor's registers, and you
14//! implement the trait corresponding to each hypercall you want to support.
15//! Then you use the [`dispatcher`] macro to instantiate a dispatcher, and you
16//! call [`Dispatcher::dispatch`] dispatch the hypercall.
17//!
18//! [Hypervisor Top Level Functional Specification]:
19//!     <https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/tlfs>
20
21#![forbid(unsafe_code)]
22
23mod aarch64;
24mod imp;
25mod support;
26#[cfg(test)]
27mod tests;
28mod x86;
29
30pub use self::aarch64::Arm64RegisterIo;
31pub use self::aarch64::Arm64RegisterState;
32pub use self::imp::*;
33pub use self::support::AsHandler;
34pub use self::support::Dispatcher;
35pub use self::support::HvRepResult;
36pub use self::support::HypercallDefinition;
37pub use self::support::HypercallHandler;
38pub use self::support::HypercallIo;
39pub use self::x86::X64HypercallRegister;
40pub use self::x86::X64RegisterIo;
41pub use self::x86::X64RegisterState;