vmbase: Move rand.rs out of pvmfw

The module isn't pvmfw-specific and could be re-used by other
vmbase-based code so move it. This will allow better future integration
with the TRNG already performed in vmbase/entry.S and with the C
interface exported by vmbase/src/bionic.rs.

Test: TH
Change-Id: I842425264c87cfe97618aceda371b410d7af6046
diff --git a/pvmfw/src/entry.rs b/pvmfw/src/entry.rs
index 0d2dfda..e2c5fc9 100644
--- a/pvmfw/src/entry.rs
+++ b/pvmfw/src/entry.rs
@@ -19,7 +19,6 @@
 use crate::fdt;
 use crate::heap;
 use crate::memory;
-use crate::rand;
 use core::arch::asm;
 use core::mem::{drop, size_of};
 use core::num::NonZeroUsize;
@@ -38,6 +37,7 @@
     logger, main,
     memory::{min_dcache_line_size, MemoryTracker, MEMORY, SIZE_4KB},
     power::reboot,
+    rand,
 };
 use zeroize::Zeroize;
 
diff --git a/pvmfw/src/instance.rs b/pvmfw/src/instance.rs
index 56468b2..1035559 100644
--- a/pvmfw/src/instance.rs
+++ b/pvmfw/src/instance.rs
@@ -21,7 +21,6 @@
 use crate::gpt;
 use crate::gpt::Partition;
 use crate::gpt::Partitions;
-use crate::rand;
 use core::fmt;
 use core::mem::size_of;
 use diced_open_dice::DiceMode;
@@ -30,6 +29,7 @@
 use log::trace;
 use uuid::Uuid;
 use virtio_drivers::transport::{pci::bus::PciRoot, DeviceType, Transport};
+use vmbase::rand;
 use vmbase::util::ceiling_div;
 use vmbase::virtio::pci::{PciTransportIterator, VirtIOBlk};
 use zerocopy::AsBytes;
diff --git a/pvmfw/src/main.rs b/pvmfw/src/main.rs
index c826cd8..8c5d5d5 100644
--- a/pvmfw/src/main.rs
+++ b/pvmfw/src/main.rs
@@ -30,10 +30,8 @@
 mod gpt;
 mod heap;
 mod helpers;
-mod hvc;
 mod instance;
 mod memory;
-mod rand;
 
 use crate::bcc::Bcc;
 use crate::dice::PartialInputs;
diff --git a/pvmfw/src/hvc.rs b/vmbase/src/hvc.rs
similarity index 100%
rename from pvmfw/src/hvc.rs
rename to vmbase/src/hvc.rs
diff --git a/pvmfw/src/hvc/trng.rs b/vmbase/src/hvc/trng.rs
similarity index 100%
rename from pvmfw/src/hvc/trng.rs
rename to vmbase/src/hvc/trng.rs
diff --git a/vmbase/src/lib.rs b/vmbase/src/lib.rs
index 54f3384..7fc7b20 100644
--- a/vmbase/src/lib.rs
+++ b/vmbase/src/lib.rs
@@ -23,11 +23,13 @@
 pub mod console;
 mod entry;
 pub mod fdt;
+mod hvc;
 pub mod layout;
 mod linker;
 pub mod logger;
 pub mod memory;
 pub mod power;
+pub mod rand;
 pub mod uart;
 pub mod util;
 pub mod virtio;
diff --git a/pvmfw/src/rand.rs b/vmbase/src/rand.rs
similarity index 100%
rename from pvmfw/src/rand.rs
rename to vmbase/src/rand.rs