use ax_errno::{AxResult, ax_err};
use axvcpu::{
AxArchPerCpu, AxArchVCpu, AxVCpuExitReason, GuestPhysAddr, HostPhysAddr, VCpuId, VMId,
};
use crate::X86VCpuSetupConfig;
pub struct X86ArchPerCpuState;
impl AxArchPerCpu for X86ArchPerCpuState {
fn new(_cpu_id: usize) -> AxResult<Self> {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn is_enabled(&self) -> bool {
false
}
fn hardware_enable(&mut self) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn hardware_disable(&mut self) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
}
pub struct X86ArchVCpu;
impl AxArchVCpu for X86ArchVCpu {
type CreateConfig = ();
type SetupConfig = X86VCpuSetupConfig;
fn new(_vm_id: VMId, _vcpu_id: VCpuId, _config: ()) -> AxResult<Self> {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn set_entry(&mut self, _entry: GuestPhysAddr) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn set_ept_root(&mut self, _ept_root: HostPhysAddr) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn setup(&mut self, _config: X86VCpuSetupConfig) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn run(&mut self) -> AxResult<AxVCpuExitReason> {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn bind(&mut self) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn unbind(&mut self) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn set_gpr(&mut self, _reg: usize, _val: usize) {
unreachable!("no hypervisor backend (vmx/svm) enabled")
}
fn inject_interrupt(&mut self, _vector: usize) -> AxResult {
ax_err!(Unsupported, "no hypervisor backend (vmx/svm) enabled")
}
fn set_return_value(&mut self, _val: usize) {
unreachable!("no hypervisor backend (vmx/svm) enabled")
}
}