vmbase: Initialize heap in rust_entry
Initialize the heap as we enter Rust so that any code that follows can
make use of alloc, preventing bugs such as aosp/2567870 where client
code used the heap before initializing it.
Test: TH
Change-Id: Ibe6629a22cd828d8b9c6418b91b5971dbbeb4c3d
diff --git a/vmbase/example/src/main.rs b/vmbase/example/src/main.rs
index d604509..ccae6ca 100644
--- a/vmbase/example/src/main.rs
+++ b/vmbase/example/src/main.rs
@@ -33,7 +33,7 @@
use fdtpci::PciInfo;
use libfdt::Fdt;
use log::{debug, error, info, trace, warn, LevelFilter};
-use vmbase::{configure_global_allocator_size, cstr, heap, logger, main, memory::SIZE_64KB};
+use vmbase::{configure_global_allocator_size, cstr, logger, main, memory::SIZE_64KB};
static INITIALISED_DATA: [u32; 4] = [1, 2, 3, 4];
static mut ZEROED_DATA: [u32; 10] = [0; 10];
@@ -69,9 +69,6 @@
modify_fdt(fdt);
- // SAFETY - Only called once, from here.
- unsafe { heap::init() };
-
check_alloc();
let mut idmap = IdMap::new(ASID, ROOT_LEVEL);