ucmd_mem.c 381 B

1234567891011121314151617181920
  1. /* Target backend for the ring-3 heap: the SYS_MEM_* arena syscalls. */
  2. #include "ucmd_lib.h"
  3. void *__heap_map(unsigned int bytes)
  4. {
  5. int base = u_syscall1(SYS_MEM_ALLOC, (int)bytes);
  6. return base < 0 ? 0 : (void *)base;
  7. }
  8. int __heap_grow(unsigned int total_bytes)
  9. {
  10. return u_syscall1(SYS_MEM_GROW, (int)total_bytes);
  11. }
  12. void __heap_unmap(void)
  13. {
  14. u_syscall0(SYS_MEM_FREE);
  15. }