COW for physically contiguous blocks in VM

This commit is contained in:
Cristiano Giuffrida 2010-07-20 18:57:25 +00:00
parent 7f343ed574
commit 40b4e71db2
2 changed files with 8 additions and 1 deletions

View file

@ -61,6 +61,11 @@ PUBLIC int do_mmap(message *m)
return EINVAL; 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_PREALLOC) mfflags |= MF_PREALLOC;
if(m->VMM_FLAGS & MAP_LOWER16M) vrflags |= VR_LOWER16MB; if(m->VMM_FLAGS & MAP_LOWER16M) vrflags |= VR_LOWER16MB;
if(m->VMM_FLAGS & MAP_LOWER1M) vrflags |= VR_LOWER1MB; if(m->VMM_FLAGS & MAP_LOWER1M) vrflags |= VR_LOWER1MB;

View file

@ -969,6 +969,7 @@ physr_iter *iter;
u32_t allocflags; u32_t allocflags;
phys_bytes physaddr; phys_bytes physaddr;
struct phys_region *newpr; struct phys_region *newpr;
int region_has_single_block;
int written = 0; int written = 0;
#if SANITYCHECKS #if SANITYCHECKS
written = ph->written; written = ph->written;
@ -1014,7 +1015,8 @@ physr_iter *iter;
/* Put new free memory in. */ /* Put new free memory in. */
allocflags = vrallocflags(region->flags); 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)); assert(!(allocflags & PAF_CLEAR));
if(map_new_physblock(vmp, region, offset, length, if(map_new_physblock(vmp, region, offset, length,