]> Zhao Yanbai Git Server - minix.git/commitdiff
COW for physically contiguous blocks in VM
authorCristiano Giuffrida <cristiano@minix3.org>
Tue, 20 Jul 2010 18:57:25 +0000 (18:57 +0000)
committerCristiano Giuffrida <cristiano@minix3.org>
Tue, 20 Jul 2010 18:57:25 +0000 (18:57 +0000)
servers/vm/mmap.c
servers/vm/region.c

index 9257f732fa0ddab9219334152c43b1e4690f0d11..47d715b5796368b3092f2ec5eec9dfaabaa51b7d 100644 (file)
@@ -61,6 +61,11 @@ PUBLIC int do_mmap(message *m)
                        return EINVAL;
                }
 
+               /* Contiguous phys memory has to be preallocated. */
+               if((m->VMM_FLAGS & (MAP_CONTIG|MAP_PREALLOC)) == MAP_CONTIG) {
+                       return EINVAL;
+               }
+
                if(m->VMM_FLAGS & MAP_PREALLOC) mfflags |= MF_PREALLOC;
                if(m->VMM_FLAGS & MAP_LOWER16M) vrflags |= VR_LOWER16MB;
                if(m->VMM_FLAGS & MAP_LOWER1M)  vrflags |= VR_LOWER1MB;
index 2b6c67d9dfbc386d63e5c40c08c3ab309ca6be85..752f1382d06596e5976d623ab3150df7950dd63a 100644 (file)
@@ -969,6 +969,7 @@ physr_iter *iter;
        u32_t allocflags;
        phys_bytes physaddr;
        struct phys_region *newpr;
+       int region_has_single_block;
        int written = 0; 
 #if SANITYCHECKS
        written = ph->written;
@@ -1014,7 +1015,8 @@ physr_iter *iter;
 
        /* Put new free memory in. */
        allocflags = vrallocflags(region->flags);
-       assert(!(allocflags & PAF_CONTIG));
+       region_has_single_block = (offset == 0 && length == region->length);
+       assert(region_has_single_block || !(allocflags & PAF_CONTIG));
        assert(!(allocflags & PAF_CLEAR));
 
        if(map_new_physblock(vmp, region, offset, length,