]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: Fix heap preallocation. 11/3111/1
authorCristiano Giuffrida <giuffrida@cs.vu.nl>
Sat, 20 Dec 2014 23:33:44 +0000 (00:33 +0100)
committerDavid van Moolenbroek <david@minix3.org>
Thu, 17 Sep 2015 13:28:17 +0000 (13:28 +0000)
Change-Id: I5b7f6473b9bbff69eae6ab26c889ad8ed902ff3a

minix/servers/vm/rs.c

index cde9f89d9733fc2bee45e4e191a1b2e22745f243..38d56bd25af133aa9ecc76d1a0bb3393e0d9beb4 100644 (file)
@@ -198,12 +198,17 @@ static int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
 static int rs_memctl_heap_prealloc(struct vmproc *vmp,
        vir_bytes *addr, size_t *len)
 {
+       struct vir_region *data_vr;
+       vir_bytes bytes;
 
-       /*
-        * XXX: Is this still needed?
-        */
+       if(*len <= 0) {
+               return EINVAL;
+       }
+       data_vr = region_search(&vmp->vm_regions_avl, VM_MMAPBASE, AVL_LESS);
+       *addr = data_vr->vaddr + data_vr->length;
+       bytes = *addr + *len;
 
-       return OK;
+       return real_brk(vmp, bytes);
 }
 
 /*===========================================================================*