|
| 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 arch-specific HyperlightVm methods |
| 18 | + |
| 19 | +use std::sync::Arc; |
| 20 | + |
| 21 | +use super::{ |
| 22 | + AccessPageTableError, CreateHyperlightVmError, DispatchGuestCallError, HyperlightVm, |
| 23 | + InitializeError, |
| 24 | +}; |
| 25 | +#[cfg(gdb)] |
| 26 | +use crate::hypervisor::gdb::{DebugCommChannel, DebugMsg, DebugResponse}; |
| 27 | +use crate::hypervisor::regs::CommonSpecialRegisters; |
| 28 | +use crate::hypervisor::virtual_machine::RegisterError; |
| 29 | +use crate::mem::mgr::SandboxMemoryManager; |
| 30 | +use crate::mem::shared_mem::{GuestSharedMemory, HostSharedMemory}; |
| 31 | +use crate::sandbox::SandboxConfiguration; |
| 32 | +use crate::sandbox::host_funcs::FunctionRegistry; |
| 33 | +use crate::sandbox::snapshot::NextAction; |
| 34 | +#[cfg(feature = "mem_profile")] |
| 35 | +use crate::sandbox::trace::MemTraceInfo; |
| 36 | +#[cfg(crashdump)] |
| 37 | +use crate::sandbox::uninitialized::SandboxRuntimeConfig; |
| 38 | + |
| 39 | +impl HyperlightVm { |
| 40 | + #[allow(clippy::too_many_arguments)] |
| 41 | + pub(crate) fn new( |
| 42 | + _snapshot_mem: GuestSharedMemory, |
| 43 | + _scratch_mem: GuestSharedMemory, |
| 44 | + _pml4_addr: u64, |
| 45 | + _entrypoint: NextAction, |
| 46 | + _rsp_gva: u64, |
| 47 | + _config: &SandboxConfiguration, |
| 48 | + #[cfg(gdb)] _gdb_conn: Option<DebugCommChannel<DebugResponse, DebugMsg>>, |
| 49 | + #[cfg(crashdump)] _rt_cfg: SandboxRuntimeConfig, |
| 50 | + #[cfg(feature = "mem_profile")] _trace_info: MemTraceInfo, |
| 51 | + ) -> std::result::Result<Self, CreateHyperlightVmError> { |
| 52 | + unimplemented!("new") |
| 53 | + } |
| 54 | + |
| 55 | + #[allow(clippy::too_many_arguments)] |
| 56 | + pub(crate) fn initialise( |
| 57 | + &mut self, |
| 58 | + _peb_addr: crate::mem::ptr::RawPtr, |
| 59 | + _seed: u64, |
| 60 | + _page_size: u32, |
| 61 | + _mem_mgr: &mut SandboxMemoryManager<HostSharedMemory>, |
| 62 | + _host_funcs: &Arc<std::sync::Mutex<FunctionRegistry>>, |
| 63 | + _guest_max_log_level: Option<tracing_core::LevelFilter>, |
| 64 | + #[cfg(gdb)] _dbg_mem_access_fn: Arc< |
| 65 | + std::sync::Mutex<SandboxMemoryManager<HostSharedMemory>>, |
| 66 | + >, |
| 67 | + ) -> Result<(), InitializeError> { |
| 68 | + unimplemented!("initialise") |
| 69 | + } |
| 70 | + |
| 71 | + pub(crate) fn dispatch_call_from_host( |
| 72 | + &mut self, |
| 73 | + _mem_mgr: &mut SandboxMemoryManager<HostSharedMemory>, |
| 74 | + _host_funcs: &Arc<std::sync::Mutex<FunctionRegistry>>, |
| 75 | + #[cfg(gdb)] _dbg_mem_access_fn: Arc< |
| 76 | + std::sync::Mutex<SandboxMemoryManager<HostSharedMemory>>, |
| 77 | + >, |
| 78 | + ) -> Result<(), DispatchGuestCallError> { |
| 79 | + unimplemented!("dispatch_call_from_host") |
| 80 | + } |
| 81 | + |
| 82 | + pub(crate) fn get_root_pt(&self) -> Result<u64, AccessPageTableError> { |
| 83 | + unimplemented!("get_root_pt") |
| 84 | + } |
| 85 | + |
| 86 | + pub(crate) fn get_snapshot_sregs( |
| 87 | + &mut self, |
| 88 | + ) -> Result<CommonSpecialRegisters, AccessPageTableError> { |
| 89 | + unimplemented!("get_snapshot_sregs") |
| 90 | + } |
| 91 | + |
| 92 | + pub(crate) fn reset_vcpu( |
| 93 | + &mut self, |
| 94 | + _cr3: u64, |
| 95 | + _sregs: &CommonSpecialRegisters, |
| 96 | + ) -> std::result::Result<(), RegisterError> { |
| 97 | + unimplemented!("reset_vcpu") |
| 98 | + } |
| 99 | +} |
0 commit comments