use libc::*;
pub type hv_return_t = u32;
pub const HV_SUCCESS: hv_return_t = 0;
pub const HV_ERROR: hv_return_t = 0xfae94001;
pub const HV_BUSY: hv_return_t = 0xfae94002;
pub const HV_BAD_ARGUMENT: hv_return_t = 0xfae94003;
pub const HV_NO_RESOURCES: hv_return_t = 0xfae94005;
pub const HV_NO_DEVICE: hv_return_t = 0xfae94006;
pub const HV_UNSUPPORTED: hv_return_t = 0xfae9400f;
pub type hv_vm_options_t = u64;
pub const HV_VM_DEFAULT: hv_vm_options_t = 0 << 0;
extern "C" {
pub fn hv_vm_create(flags: hv_vm_options_t) -> hv_return_t;
pub fn hv_vm_destroy() -> hv_return_t;
}
pub type hv_vcpuid_t = c_uint;
pub const HV_VCPU_DEFAULT: u64 = 0;
extern "C" {
pub fn hv_vcpu_create(vcpu: *mut hv_vcpuid_t, flags: hv_vm_options_t) -> hv_return_t;
pub fn hv_vcpu_run(vcpu: hv_vcpuid_t) -> hv_return_t;
pub fn hv_vcpu_interrupt(vcpu: *const hv_vcpuid_t, vcpu_count: c_uint) -> hv_return_t;
pub fn hv_vcpu_get_exec_time(vcpu: hv_vcpuid_t, time: *mut u64) -> hv_return_t;
pub fn hv_vcpu_flush(vcpu: hv_vcpuid_t) -> hv_return_t;
pub fn hv_vcpu_invalidate_tlb(vcpu: hv_vcpuid_t) -> hv_return_t;
pub fn hv_vcpu_destroy(vcpu: hv_vcpuid_t) -> hv_return_t;
}
extern "C" {
pub fn hv_vcpu_read_register(
vcpu: hv_vcpuid_t,
reg: super::Register,
value: *mut u64,
) -> hv_return_t;
pub fn hv_vcpu_write_register(
vcpu: hv_vcpuid_t,
reg: super::Register,
value: u64,
) -> hv_return_t;
}
extern "C" {
pub fn hv_vcpu_read_fpstate(
vcpu: hv_vcpuid_t,
buffer: *mut c_void,
size: size_t,
) -> hv_return_t;
pub fn hv_vcpu_write_fpstate(
vcpu: hv_vcpuid_t,
buffer: *const c_void,
size: size_t,
) -> hv_return_t;
}
extern "C" {
pub fn hv_vcpu_enable_native_msr(vcpu: hv_vcpuid_t, msr: u32, enable: bool) -> hv_return_t;
pub fn hv_vcpu_read_msr(vcpu: hv_vcpuid_t, msr: u32, value: *mut u64) -> hv_return_t;
pub fn hv_vcpu_write_msr(vcpu: hv_vcpuid_t, msr: u32, value: *const u64) -> hv_return_t;
}
extern "C" {
pub fn hv_vm_sync_tsc(tsc: u64) -> hv_return_t;
}
pub type hv_uvaddr_t = *const c_void;
pub type hv_memory_flags_t = u64;
pub type hv_gpaddr_t = u64;
pub const HV_MEMORY_READ: hv_memory_flags_t = 1 << 0;
pub const HV_MEMORY_WRITE: hv_memory_flags_t = 1 << 1;
pub const HV_MEMORY_EXEC: hv_memory_flags_t = 1 << 2;
extern "C" {
pub fn hv_vm_map(
uva: hv_uvaddr_t,
gpa: hv_gpaddr_t,
size: size_t,
flags: hv_memory_flags_t,
) -> hv_return_t;
pub fn hv_vm_unmap(gpa: hv_gpaddr_t, size: size_t) -> hv_return_t;
pub fn hv_vm_protect(gpa: hv_gpaddr_t, size: size_t, flags: hv_memory_flags_t) -> hv_return_t;
}
extern "C" {
pub fn hv_vmx_vcpu_read_vmcs(vcpu: hv_vcpuid_t, field: u32, value: *mut u64) -> hv_return_t;
pub fn hv_vmx_vcpu_write_vmcs(vcpu: hv_vcpuid_t, field: u32, value: u64) -> hv_return_t;
pub fn hv_vmx_read_capability(field: super::VMXCap, value: *mut u64) -> hv_return_t;
pub fn hv_vmx_vcpu_set_apic_address(vcpu: hv_vcpuid_t, gpa: hv_gpaddr_t) -> hv_return_t;
}