vmbase: Export linker-defined MemoryRegions & VAs
Group all linker-defined variables in a private module.
Export the memory regions defined by the linker as safe Range<usize>.
Export __stack_chk_guard as a safe static &u64.
Bug: 238050226
Test: atest vmbase_example.integration_test
Change-Id: I401ac4af949e283f78fbc576db19339e38ed3942
diff --git a/vmbase/src/lib.rs b/vmbase/src/lib.rs
index 9c9417a..a012442 100644
--- a/vmbase/src/lib.rs
+++ b/vmbase/src/lib.rs
@@ -18,6 +18,8 @@
pub mod console;
mod entry;
+pub mod layout;
+mod linker;
pub mod logger;
pub mod power;
pub mod uart;
@@ -31,6 +33,9 @@
reboot()
}
+/// Reference to __stack_chk_guard.
+pub static STACK_CHK_GUARD: &u64 = unsafe { &linker::__stack_chk_guard };
+
#[no_mangle]
extern "C" fn __stack_chk_fail() -> ! {
panic!("stack guard check failed");