Add memory allocation support for C programs (#12254)

This commit is contained in:
Jack May
2020-09-15 16:42:20 -07:00
committed by GitHub
parent 3d4b9bb00d
commit 5ab4109b7e
4 changed files with 91 additions and 13 deletions

View File

@ -35,7 +35,7 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u64 {
// Test allocated memory read and write
const ITERS: usize = 100;
let layout = Layout::from_size_align(100, mem::align_of::<u8>()).unwrap();
let layout = Layout::from_size_align(ITERS, mem::align_of::<u8>()).unwrap();
let ptr = alloc::alloc::alloc(layout);
if ptr.is_null() {
info!("Error: Alloc failed");