1 // Copyright 2017 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 //! Emulates virtual and hardware devices. 6 7 mod bus; 8 mod cmos; 9 #[cfg(feature = "direct")] 10 pub mod direct_io; 11 #[cfg(feature = "direct")] 12 pub mod direct_irq; 13 mod i8042; 14 pub mod irqchip; 15 mod pci; 16 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] 17 mod pit; 18 pub mod pl030; 19 mod proxy; 20 #[macro_use] 21 mod register_space; 22 pub mod acpi; 23 pub mod bat; 24 mod serial; 25 mod serial_device; 26 pub mod usb; 27 mod utils; 28 pub mod vfio; 29 pub mod virtio; 30 31 pub use self::acpi::ACPIPMResource; 32 pub use self::bat::{BatteryError, GoldfishBattery}; 33 pub use self::bus::Error as BusError; 34 pub use self::bus::{Bus, BusAccessInfo, BusDevice, BusDeviceSync, BusRange, BusResumeDevice}; 35 pub use self::cmos::Cmos; 36 #[cfg(feature = "direct")] 37 pub use self::direct_io::DirectIo; 38 #[cfg(feature = "direct")] 39 pub use self::direct_irq::{DirectIrq, DirectIrqError}; 40 pub use self::i8042::I8042Device; 41 pub use self::irqchip::*; 42 #[cfg(feature = "audio")] 43 pub use self::pci::{Ac97Backend, Ac97Dev, Ac97Parameters}; 44 pub use self::pci::{ 45 PciAddress, PciConfigIo, PciConfigMmio, PciDevice, PciDeviceError, PciInterruptPin, PciRoot, 46 VfioPciDevice, 47 }; 48 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] 49 pub use self::pit::{Pit, PitError}; 50 pub use self::pl030::Pl030; 51 pub use self::proxy::Error as ProxyError; 52 pub use self::proxy::ProxyDevice; 53 pub use self::serial::Serial; 54 pub use self::serial_device::SerialDevice; 55 pub use self::usb::host_backend::host_backend_device_provider::HostBackendDeviceProvider; 56 pub use self::usb::xhci::xhci_controller::XhciController; 57 pub use self::vfio::{VfioContainer, VfioDevice}; 58 pub use self::virtio::VirtioPciDevice; 59 60 /// Whether the VM should be run in protected mode or not. 61 #[derive(Copy, Clone, Debug, Eq, PartialEq)] 62 pub enum ProtectionType { 63 /// The VM should be run in the unprotected mode, where the host has access to its memory. 64 Unprotected, 65 /// The VM should be run in protected mode, so the host cannot access its memory directly. 66 Protected, 67 } 68