Changeset 21916 for trunk/src/kernel32/mmapview.cpp
- Timestamp:
- Dec 18, 2011, 10:28:22 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 bin 2 Makefile.inc 1 env.cmd 2 LocalConfig.kmk
-
-
Property svn:mergeinfo
set to
/branches/gcc-kmk merged eligible
- Property svn:ignore
-
trunk/src/kernel32/mmapview.cpp
r21302 r21916 28 28 #include <stdlib.h> 29 29 #include <string.h> 30 #include <win \virtual.h>30 #include <win/virtual.h> 31 31 #include <odincrt.h> 32 32 #include <handlemanager.h> … … 34 34 #include "oslibdos.h" 35 35 #include "oslibmem.h" 36 #include <winimagepeldr.h>37 #include <custombuild.h> 36 #include "winimagepeldr.h" 37 #include <custombuild.h> 38 38 39 39 #define DBG_LOCALLOG DBG_mmapview … … 51 51 // 52 52 //****************************************************************************** 53 Win32MemMapView::Win32MemMapView(Win32MemMap *map, ULONG offset, ULONG size, 53 Win32MemMapView::Win32MemMapView(Win32MemMap *map, ULONG offset, ULONG size, 54 54 ULONG fdwAccess, Win32MemMap *owner) 55 55 { … … 87 87 { 88 88 //shared memory map, so map it into our address space 89 if(OSLibDosGetNamedSharedMem((LPVOID *)&viewaddr, map->getMemName()) != OSLIB_NOERROR) 89 if(OSLibDosGetNamedSharedMem((LPVOID *)&viewaddr, map->getMemName()) != OSLIB_NOERROR) 90 90 { 91 91 dprintf(("new OSLibDosGetNamedSharedMem FAILED")); … … 104 104 } 105 105 else { 106 if(mfAccess & MEMMAP_ACCESS_COPYONWRITE) 106 if(mfAccess & MEMMAP_ACCESS_COPYONWRITE) 107 107 { 108 108 //A copy on write view is a private copy of the memory map … … 118 118 } 119 119 } 120 else 120 else 121 121 if(OSLibDosAliasMem(viewaddr, size, &pMapView, accessAttr) != OSLIB_NOERROR) { 122 122 dprintf(("new OSLibDosAliasMem FAILED")); … … 126 126 } 127 127 } 128 //Allocate bitmap for all pages of a COW view to track which pages are 128 //Allocate bitmap for all pages of a COW view to track which pages are 129 129 //shared and which are private (copy on write -> private page) 130 if(fdwAccess == FILE_MAP_COPY) 130 if(fdwAccess == FILE_MAP_COPY) 131 131 { 132 132 DWORD nrPages = mSize >> PAGE_SHIFT; … … 242 242 viewpagestart = mOffset >> PAGE_SHIFT; 243 243 nrviewpages = mSize >> PAGE_SHIFT; 244 if(mSize & 0xFFF) 244 if(mSize & 0xFFF) 245 245 nrviewpages++; 246 246 … … 248 248 return; //outside this view 249 249 } 250 if(startpage + nrpages > viewpagestart + nrviewpages) { 250 if(startpage + nrpages > viewpagestart + nrviewpages) { 251 251 nrpages -= ((startpage + nrpages) - (viewpagestart + nrviewpages)); 252 252 } … … 286 286 } 287 287 288 if( ( (mfAccess & MEMMAP_ACCESS_COPYONWRITE) && (flags != PAGEVIEW_GUARD) ) || 289 ( (flags == PAGEVIEW_GUARD) && !(mfAccess & MEMMAP_ACCESS_COPYONWRITE) ) ) 288 if( ( (mfAccess & MEMMAP_ACCESS_COPYONWRITE) && (flags != PAGEVIEW_GUARD) ) || 289 ( (flags == PAGEVIEW_GUARD) && !(mfAccess & MEMMAP_ACCESS_COPYONWRITE) ) ) 290 290 { 291 291 //PAGEVIEW_GUARD only applies to COW views 292 292 //PAGEVIEW_VIEW/READONLY does not apply to COW views 293 return TRUE; 293 return TRUE; 294 294 } 295 295 if(mOffset + mSize <= offset || mOffset >= offset + size) { … … 320 320 } 321 321 322 if(flags == PAGEVIEW_GUARD || (mfAccess & MEMMAP_ACCESS_COPYONWRITE)) 322 if(flags == PAGEVIEW_GUARD || (mfAccess & MEMMAP_ACCESS_COPYONWRITE)) 323 323 { 324 324 DWORD startpage = (offset - mOffset) >> PAGE_SHIFT; … … 330 330 //of the COW pages, then only the shared pages must be changed. 331 331 //So check each page if it is still shared. 332 for(int i=startpage;i<startpage+nrPages;i++) 332 for(int i=startpage;i<startpage+nrPages;i++) 333 333 { 334 if(!isCOWPage(i)) 334 if(!isCOWPage(i)) 335 335 {//page is still shared, so set the guard flag 336 336 rc = OSLibDosSetMem((char *)pMapView+(offset - mOffset), PAGE_SIZE, accessAttr); … … 354 354 //****************************************************************************** 355 355 //****************************************************************************** 356 int Win32MemMapView::findViews(Win32MemMap *map, int nrViews, 356 int Win32MemMapView::findViews(Win32MemMap *map, int nrViews, 357 357 Win32MemMapView *viewarray[]) 358 358 { … … 362 362 Win32MemMapView *view = mapviews, *nextview; 363 363 364 if(view != NULL) 364 if(view != NULL) 365 365 { 366 while(view && i < nrViews) 366 while(view && i < nrViews) 367 367 { 368 368 if(view->getParentMap() == map) … … 384 384 Win32MemMapView *view = mapviews, *nextview; 385 385 386 if(view != NULL) 386 if(view != NULL) 387 387 { 388 while(view) 388 while(view) 389 389 { 390 390 nextview = view->next; … … 404 404 // Win32MemMap::findMapByView 405 405 // 406 // Find the map of the view that contains the specified starting address 406 // Find the map of the view that contains the specified starting address 407 407 // and has the specified access type 408 408 //
Note:
See TracChangeset
for help on using the changeset viewer.