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/vmbase/src/exceptions.rs b/vmbase/src/exceptions.rs
index 7833334..11fcd93 100644
--- a/vmbase/src/exceptions.rs
+++ b/vmbase/src/exceptions.rs
@@ -15,15 +15,14 @@
//! Helper functions and structs for exception handlers.
use crate::{
- console, eprintln,
+ eprintln,
+ layout::UART_PAGE_ADDR,
memory::{page_4kb_of, MemoryTrackerError},
read_sysreg,
};
use aarch64_paging::paging::VirtualAddress;
use core::fmt;
-const UART_PAGE: usize = page_4kb_of(console::BASE_ADDRESS);
-
/// Represents an error that can occur while handling an exception.
#[derive(Debug)]
pub enum HandleExceptionError {
@@ -134,6 +133,6 @@
}
fn is_uart_exception(&self) -> bool {
- self.esr == Esr::DataAbortSyncExternalAbort && page_4kb_of(self.far.0) == UART_PAGE
+ self.esr == Esr::DataAbortSyncExternalAbort && page_4kb_of(self.far.0) == UART_PAGE_ADDR
}
}