vmbase: Export VirtualAddress from arch
This change switches from using VirtualAddress directly from aarch64_paging
crate but from the same type rexported from crate::arch module. This is
currently a purely cosmetical change now. But once the x86_64 supports
will be brought to life, a different type will be in use and rexporting
will prevent excessive use of `cfg(target_arch = "aarch64")` for
imports.
Bug: 362733888
Test: m libvmbase pvmfw_bin vmbase_example_bios_bin vmbase_example_kernel_bin
Change-Id: I57d5a76457f7c396aee2c6528ebd0bb6c93c08c4
diff --git a/libs/libvmbase/src/arch.rs b/libs/libvmbase/src/arch.rs
index 9e4523e..49978d5 100644
--- a/libs/libvmbase/src/arch.rs
+++ b/libs/libvmbase/src/arch.rs
@@ -32,6 +32,9 @@
#[cfg(target_arch = "aarch64")]
pub use aarch64::uart;
+#[cfg(target_arch = "aarch64")]
+pub use aarch64_paging::paging::VirtualAddress;
+
/// Write with well-defined compiled behavior.
///
/// See https://github.com/rust-lang/rust/issues/131894
diff --git a/libs/libvmbase/src/arch/aarch64/exceptions.rs b/libs/libvmbase/src/arch/aarch64/exceptions.rs
index 7618371..1868bf7 100644
--- a/libs/libvmbase/src/arch/aarch64/exceptions.rs
+++ b/libs/libvmbase/src/arch/aarch64/exceptions.rs
@@ -15,8 +15,10 @@
//! Helper functions and structs for exception handlers.
use crate::memory::{MemoryTrackerError, MEMORY};
-use crate::{arch::aarch64::layout::UART_PAGE_ADDR, eprintln, memory::page_4kb_of, read_sysreg};
-use aarch64_paging::paging::VirtualAddress;
+use crate::{
+ arch::aarch64::layout::UART_PAGE_ADDR, arch::VirtualAddress, eprintln, memory::page_4kb_of,
+ read_sysreg,
+};
use core::fmt;
use core::result;
diff --git a/libs/libvmbase/src/layout.rs b/libs/libvmbase/src/layout.rs
index 9e1f483..8bc2319 100644
--- a/libs/libvmbase/src/layout.rs
+++ b/libs/libvmbase/src/layout.rs
@@ -18,9 +18,8 @@
#[cfg(target_arch = "aarch64")]
use crate::arch::aarch64::linker::__stack_chk_guard;
+use crate::arch::VirtualAddress;
use crate::memory::{max_stack_size, PAGE_SIZE};
-#[cfg(target_arch = "aarch64")]
-use aarch64_paging::paging::VirtualAddress;
use core::ops::Range;
#[cfg(target_arch = "aarch64")]
diff --git a/libs/libvmbase/src/memory/shared.rs b/libs/libvmbase/src/memory/shared.rs
index a4eb93a..ce57793 100644
--- a/libs/libvmbase/src/memory/shared.rs
+++ b/libs/libvmbase/src/memory/shared.rs
@@ -16,9 +16,10 @@
use super::error::MemoryTrackerError;
use super::util::virt_to_phys;
+use crate::arch::VirtualAddress;
use crate::layout;
use crate::util::unchecked_align_down;
-use aarch64_paging::paging::{MemoryRegion as VaRange, VirtualAddress, PAGE_SIZE};
+use aarch64_paging::paging::{MemoryRegion as VaRange, PAGE_SIZE};
use alloc::alloc::{alloc_zeroed, dealloc, handle_alloc_error};
use alloc::collections::BTreeSet;
use alloc::vec::Vec;
diff --git a/libs/libvmbase/src/memory/tracker.rs b/libs/libvmbase/src/memory/tracker.rs
index 880e4da..cdaae55 100644
--- a/libs/libvmbase/src/memory/tracker.rs
+++ b/libs/libvmbase/src/memory/tracker.rs
@@ -18,11 +18,12 @@
use super::shared::{SHARED_MEMORY, SHARED_POOL};
use crate::arch::aarch64::page_table::{PageTable, MMIO_LAZY_MAP_FLAG};
use crate::arch::dbm::{flush_dirty_range, mark_dirty_block, set_dbm_enabled};
+use crate::arch::VirtualAddress;
use crate::dsb;
use crate::layout;
use crate::memory::shared::{MemoryRange, MemorySharer, MmioSharer};
use crate::util::RangeExt as _;
-use aarch64_paging::paging::{Attributes, Descriptor, MemoryRegion as VaRange, VirtualAddress};
+use aarch64_paging::paging::{Attributes, Descriptor, MemoryRegion as VaRange};
use alloc::boxed::Box;
use buddy_system_allocator::LockedFrameAllocator;
use core::mem::size_of;