Skip to content

Commit cdf5757

Browse files
committed
switch
1 parent ab48d46 commit cdf5757

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pa3.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,13 @@ void switch_process(unsigned int pid){
235235
for(int j=0;j<NR_PTES_PER_PAGE;j++){
236236
if(current->pagetable.outer_ptes[i]->ptes[j].valid){
237237

238-
if(current->pagetable.outer_ptes[i]->ptes[j].writable==false){//쓰기모드 아닌거
239-
child->pagetable.outer_ptes[i]->ptes[j].private = false;
240-
current->pagetable.outer_ptes[i]->ptes[j].private = false;
241-
}
238+
if(current->pagetable.outer_ptes[i]->ptes[j].writable==true)//쓰기모드 아닌거
239+
current->pagetable.outer_ptes[i]->ptes[j].private = true;
242240
else{
243241
child->pagetable.outer_ptes[i]->ptes[j].private = true;
244242
current->pagetable.outer_ptes[i]->ptes[j].private = true;
245243
}
246-
244+
247245
child->pagetable.outer_ptes[i]->ptes[j].writable = false;//CoW
248246
current->pagetable.outer_ptes[i]->ptes[j].writable = false;//CoW
249247

@@ -253,6 +251,9 @@ void switch_process(unsigned int pid){
253251
child->pagetable.outer_ptes[i]->ptes[j].pfn =
254252
current->pagetable.outer_ptes[i]->ptes[j].pfn;
255253

254+
child->pagetable.outer_ptes[i]->ptes[j].private =
255+
current->pagetable.outer_ptes[i]->ptes[j].private;
256+
256257
mapcounts[child->pagetable.outer_ptes[i]->ptes[j].pfn]++;
257258
}
258259
}//for i

0 commit comments

Comments
 (0)