Back to index

plt-scheme  4.2.1
vm_osk.c
Go to the documentation of this file.
00001 /* 
00002    Provides:
00003       allocator
00004       determine_max_heap_size()
00005    Requires:
00006    Optional:
00007       DONT_NEED_MAX_HEAP_SIZE --- to disable a provide
00008 */
00009 
00010 #include <oskit/c/malloc.h>
00011 
00012 inline static void *vm_malloc_pages(VM *vm, size_t len, size_t alignment, int dirty_ok)
00013 {
00014   void *p;
00015 
00016   p = smemalign(alignment, len);
00017   
00018   if (!dirty_ok)
00019   memset(p, 0, len);
00020 
00021   vm_memory_allocated_inc(vm, len);
00022 
00023   return p;
00024 }
00025 
00026 static void vm_free_pages(VM *vm, void *p, size_t len)
00027 {
00028   vm_memory_allocated_dec(vm, len);
00029   sfree(p, len);
00030 }
00031 
00032 static void vm_flush_freed_pages(VM *vm)
00033 {
00034 }
00035 
00036 #ifndef DONT_NEED_MAX_HEAP_SIZE
00037 static unsigned long determine_max_heap_size(void)
00038 {
00039   GCPRINT(GCOUTF, "Don't know how to get heap size for OSKit: assuming 1GB\n");
00040   return (1 * 1024 * 1024 * 1024);
00041 }
00042 #endif