1use thiserror::Error;
2use vmm::vstate::memory::GuestAddress;
3
4#[derive(Error, Debug)]
5pub enum NyxError {
6 #[error("Failed Memory Operation")]
7 Memory(MemoryError),
8 }
18
19#[derive(Error, Debug, PartialEq, Eq)]
20pub enum MemoryError {
21 #[error("could not read from p:{:x}", (.0).0)]
22 CantAccessMissingPhysicalPage(GuestAddress),
23 #[error("could not read from p:{:x} (size: {})", (.0).0, .1)]
24 CantReadPhysicalPage(GuestAddress, usize),
25 #[error("could not write to p:{:x} (size: {})", (.0).0, .1)]
26 CantWritePhysicalPage(GuestAddress, usize),
27 #[error("page at page_table p:{:x}:{} is not present", (.0).0 ,.1)]
28 PageNotPresent(GuestAddress, u64),
29 #[error("unaligned address: {0:#x}")]
30 UnalignedAddress(u64),
31 #[error("missing page table for vaddr: {0:#x}")]
32 MissingPageTable(u64),
33 #[error("unable to allocate page table for vaddr: {0:#x}")]
34 PageTableAllocationFailed(u64),
35}