message: add "system call" to allocate memory
diff: @@ -66,12 +66,40 @@ pub use arch::*;
  pub use syscalls::*;
  use arch::percore::*;
  -use core::ptr;
  use mm::allocator;
  +use core::ptr;
  +use core::alloc::GlobalAlloc;
  +use alloc::alloc::Layout;
  #[global_allocator]
  static ALLOCATOR: &'static allocator::HermitAllocator = &allocator::HermitAllocator;
  +#[no_mangle]
  +pub extern "C" fn sys_malloc(size: usize, align: usize) -> *mut u8 {
  + let layout: Layout = Layout::from_size_align(size, align).unwrap();
  +
  + unsafe {
  + ALLOCATOR.alloc(layout)
  + }
  +}
  +
  +#[no_mangle]
  +pub extern "C" fn sys_realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8 {
  + let layout: Layout = Layout::from_size_align(size, align).unwrap();
  +
  + unsafe {
  + ALLOCATOR.realloc(ptr, layout, new_size)
  + }
  +}
  +
  +#[no_mangle]
  +pub extern "C" fn sys_free(ptr: *mut u8, size: usize, align: usize) {
  + let layout: Layout = Layout::from_size_align(size, align).unwrap();
  +
  + unsafe {
  + ALLOCATOR.dealloc(ptr, layout);
  + }
  +}
  extern "C" {
  static mut __bss_start: u8;
  