#![allow(unused_imports)] use flagset::flags; use core::alloc::{Allocator, Layout}; use spin; use talc::*; pub extern crate alloc; static mut ARENA: [u8; 10000] = [0; 10000]; #[global_allocator] static ALLOCATOR: Talck, ClaimOnOom> = Talc::new(unsafe { // if we're in a hosted environment, the Rust runtime may allocate before // main() is called, so we need to initialize the arena automatically ClaimOnOom::new(Span::from_array(core::ptr::addr_of!(ARENA).cast_mut())) }) .lock(); #[allow(dead_code)] pub struct MemoryRegion { start_address: usize, end_address: usize, flags: MemoryRegionFlags, } flags! { pub enum MemoryRegionFlags: u8 { READABLE, WRITABLE, EXECUTABLE, } }