Turn hypervisor backends module into a library
Break out the code in the hyp module of libvmbase
into its own library such that it can be used from
other contexts such as the Trusty kernel.
Update uses in guest/{pvmfw,rialto}.
Add Trusty build rules for the new library.
Test: atest
Test: build.py generic-x86_64-test
Change-Id: I68670549c8c8e1b3c8539c2c297e2ca1ba24edfb
diff --git a/guest/rialto/Android.bp b/guest/rialto/Android.bp
index 7bcfd54..8afb8ba 100644
--- a/guest/rialto/Android.bp
+++ b/guest/rialto/Android.bp
@@ -14,6 +14,7 @@
"libciborium_nostd",
"libcstr",
"libdiced_open_dice_nostd",
+ "libhypervisor_backends",
"liblibfdt_nostd",
"liblog_rust_nostd",
"libservice_vm_comm_nostd",
diff --git a/guest/rialto/src/error.rs b/guest/rialto/src/error.rs
index ba5f4b0..f021c36 100644
--- a/guest/rialto/src/error.rs
+++ b/guest/rialto/src/error.rs
@@ -17,11 +17,10 @@
use aarch64_paging::MapError;
use core::{fmt, result};
use diced_open_dice::DiceError;
+use hypervisor_backends::Error as HypervisorError;
use libfdt::FdtError;
use service_vm_comm::RequestProcessingError;
-use vmbase::{
- fdt::pci::PciError, hyp::Error as HypervisorError, memory::MemoryTrackerError, virtio::pci,
-};
+use vmbase::{fdt::pci::PciError, memory::MemoryTrackerError, virtio::pci};
pub type Result<T> = result::Result<T, Error>;
diff --git a/guest/rialto/src/main.rs b/guest/rialto/src/main.rs
index ec9a76e..244010d 100644
--- a/guest/rialto/src/main.rs
+++ b/guest/rialto/src/main.rs
@@ -32,6 +32,7 @@
use core::num::NonZeroUsize;
use core::slice;
use diced_open_dice::{bcc_handover_parse, DiceArtifacts};
+use hypervisor_backends::get_mem_sharer;
use libfdt::FdtError;
use log::{debug, error, info};
use service_vm_comm::{ServiceVmRequest, VmType};
@@ -47,7 +48,6 @@
fdt::pci::PciInfo,
fdt::SwiotlbInfo,
generate_image_header,
- hyp::get_mem_sharer,
layout::{self, crosvm},
main,
memory::{MemoryTracker, PageTable, MEMORY, PAGE_SIZE, SIZE_128KB},