kern

changeset 64:c2692696f9ab

forgot to handle the cow argument to clone_vm
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 17 Aug 2011 05:43:47 +0300
parents f44bec97a0ec
children e49fdda97607
files src/vm.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/src/vm.c	Wed Aug 17 05:42:44 2011 +0300
     1.2 +++ b/src/vm.c	Wed Aug 17 05:43:47 2011 +0300
     1.3 @@ -609,11 +609,13 @@
     1.4  	/* user space */
     1.5  	for(i=0; i<kstart_dirent; i++) {
     1.6  		if(pgdir[i] & PG_PRESENT) {
     1.7 -			/* first go through all the entries of the existing
     1.8 -			 * page table and unset the writable bits.
     1.9 -			 */
    1.10 -			for(j=0; j<1024; j++) {
    1.11 -				PGTBL(i)[j] &= ~(uint32_t)PG_WRITABLE;
    1.12 +			if(cow) {
    1.13 +				/* first go through all the entries of the existing
    1.14 +				 * page table and unset the writable bits.
    1.15 +				 */
    1.16 +				for(j=0; j<1024; j++) {
    1.17 +					PGTBL(i)[j] &= ~(uint32_t)PG_WRITABLE;
    1.18 +				}
    1.19  			}
    1.20  
    1.21  			/* allocate a page table for the clone */
    1.22 @@ -635,8 +637,10 @@
    1.23  		ndir[i] = pgdir[i];
    1.24  	}
    1.25  
    1.26 -	/* we just changed all the page protection bits, so we need to flush the TLB */
    1.27 -	flush_tlb();
    1.28 +	if(cow) {
    1.29 +		/* we just changed all the page protection bits, so we need to flush the TLB */
    1.30 +		flush_tlb();
    1.31 +	}
    1.32  
    1.33  	paddr = virt_to_phys((uint32_t)ndir);
    1.34