vmbase: Introduce layout::UART_PAGE
As most users of console::BASE_ADDRESS align it to the page granule,
provide a constant that already represent the base of the page. Make it
part of vmbase::layout (instead of vmbase::console) as it is, in fact,
defined by the VM layout.
As console_uart_range() is only used for constructing page tables, which
can only map ranges at page granularity, rework it based on UART_PAGE.
Test: m pvmfw librialto libvmbase_example
Change-Id: I9942e193d575b32072e880fa345c3634b1561298
diff --git a/pvmfw/src/entry.rs b/pvmfw/src/entry.rs
index 43822a5..cc6e302 100644
--- a/pvmfw/src/entry.rs
+++ b/pvmfw/src/entry.rs
@@ -30,9 +30,9 @@
use log::LevelFilter;
use vmbase::util::RangeExt as _;
use vmbase::{
- configure_heap, console,
+ configure_heap,
hyp::{get_mem_sharer, get_mmio_guard},
- layout::{self, crosvm},
+ layout::{self, crosvm, UART_PAGE_ADDR},
main,
memory::{min_dcache_line_size, MemoryTracker, MEMORY, SIZE_128KB, SIZE_4KB},
power::reboot,
@@ -256,7 +256,7 @@
// Call unshare_all_memory here (instead of relying on the dtor) while UART is still mapped.
MEMORY.lock().as_mut().unwrap().unshare_all_memory();
if let Some(mmio_guard) = get_mmio_guard() {
- mmio_guard.unmap(console::BASE_ADDRESS).map_err(|e| {
+ mmio_guard.unmap(UART_PAGE_ADDR).map_err(|e| {
error!("Failed to unshare the UART: {e}");
RebootReason::InternalError
})?;