diff --git a/vmm/src/acpi.rs b/vmm/src/acpi.rs index a6e9c6236..a2d6a7a72 100644 --- a/vmm/src/acpi.rs +++ b/vmm/src/acpi.rs @@ -41,7 +41,7 @@ pub const ACPI_APIC_GENERIC_TRANSLATOR: u8 = 15; #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct PciRangeEntry { pub base_address: u64, pub segment: u16, @@ -52,7 +52,7 @@ struct PciRangeEntry { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct MemoryAffinity { pub type_: u8, pub length: u8, @@ -69,7 +69,7 @@ struct MemoryAffinity { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct ProcessorLocalX2ApicAffinity { pub type_: u8, pub length: u8, @@ -83,7 +83,7 @@ struct ProcessorLocalX2ApicAffinity { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct ProcessorGiccAffinity { pub type_: u8, pub length: u8, @@ -143,7 +143,7 @@ impl MemoryAffinity { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct ViotVirtioPciNode { pub type_: u8, _reserved: u8, @@ -155,7 +155,7 @@ struct ViotVirtioPciNode { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct ViotPciRangeNode { pub type_: u8, _reserved: u8, diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index afb247841..fc7885443 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -84,6 +84,7 @@ use vm_migration::{ }; use vmm_sys_util::eventfd::EventFd; use vmm_sys_util::signal::{register_signal_handler, SIGRTMIN}; +use zerocopy::AsBytes; #[cfg(all(target_arch = "aarch64", feature = "guest_debug"))] /// Extract the specified bits of a 64-bit integer. @@ -176,6 +177,7 @@ pub type Result = result::Result; #[cfg(target_arch = "x86_64")] #[allow(dead_code)] #[repr(packed)] +#[derive(AsBytes)] struct LocalApic { pub r#type: u8, pub length: u8, @@ -186,7 +188,7 @@ struct LocalApic { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct Ioapic { pub r#type: u8, pub length: u8, @@ -199,6 +201,7 @@ struct Ioapic { #[cfg(target_arch = "aarch64")] #[allow(dead_code)] #[repr(packed)] +#[derive(AsBytes)] struct GicC { pub r#type: u8, pub length: u8, @@ -223,6 +226,7 @@ struct GicC { #[cfg(target_arch = "aarch64")] #[allow(dead_code)] #[repr(packed)] +#[derive(AsBytes)] struct GicD { pub r#type: u8, pub length: u8, @@ -237,6 +241,7 @@ struct GicD { #[cfg(target_arch = "aarch64")] #[allow(dead_code)] #[repr(packed)] +#[derive(AsBytes)] struct GicR { pub r#type: u8, pub length: u8, @@ -248,6 +253,7 @@ struct GicR { #[cfg(target_arch = "aarch64")] #[allow(dead_code)] #[repr(packed)] +#[derive(AsBytes)] struct GicIts { pub r#type: u8, pub length: u8, @@ -260,6 +266,7 @@ struct GicIts { #[cfg(target_arch = "aarch64")] #[allow(dead_code)] #[repr(packed)] +#[derive(AsBytes)] struct ProcessorHierarchyNode { pub r#type: u8, pub length: u8, @@ -272,7 +279,7 @@ struct ProcessorHierarchyNode { #[allow(dead_code)] #[repr(packed)] -#[derive(Default)] +#[derive(Default, AsBytes)] struct InterruptSourceOverride { pub r#type: u8, pub length: u8,