Show
Ignore:
Timestamp:
05/27/10 13:45:58 (2 years ago)
Author:
mwhitworth
Message:

FIx issue with two threads faulting on the same page.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/netchannel/memory/mmap.c

    r2084 r2098  
    108108                        /* So no luck finding it in the VNode's mapping list - read it in */ 
    109109                        newPage=PageAlloc(); 
    110  
     110                         
    111111                        if (!newPage) 
    112112                                return -ENOMEM; 
    113113 
    114                         VirtMemMapPage(address, newPage->physAddr, 
    115                                 area->protection | PAGE_ACCESSED | PAGE_SHARED); 
     114                        DWORD tempAddr = VirtAllocateTemp(newPage->physAddr); 
    116115 
    117116                        /* Add to shared list so other read-only pages can map this page */ 
     
    123122                        VmLockPage(mappedPage); 
    124123                        ListAdd(&mappedPage->list, &area->vNode->sharedList); 
     124 
    125125                        if (area->vNode->fileOps->mMap) 
    126                                 ret=area->vNode->fileOps->mMap(area->vNode, address, offset); 
     126                                ret = area->vNode->fileOps->mMap(area->vNode, tempAddr, offset); 
    127127                        else 
    128                                 ret=FileGenericReadPage(address,area->vNode,offset); 
     128                                ret = FileGenericReadPage(tempAddr, area->vNode,offset); 
     129 
     130                        VirtUnmapPhysPage(tempAddr); 
     131 
     132                        VirtMemMapPage(address, newPage->physAddr, 
     133                                area->protection); 
    129134 
    130135                        VmUnlockPage(mappedPage);