Changeset 21916 for trunk/src/kernel32/oslibmem.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/oslibmem.cpp
r21339 r21916 31 31 #include <win32api.h> 32 32 #include <winconst.h> 33 #include <win \winioctl.h>33 #include <win/winioctl.h> 34 34 #include <dbglog.h> 35 35 #include <vmutex.h> … … 91 91 tmp = allocrecords; 92 92 while(tmp->next) { 93 if(tmp->next->baseaddr > baseaddr) { 93 if(tmp->next->baseaddr > baseaddr) { 94 94 break; 95 95 } … … 121 121 tmp = allocrecords; 122 122 while(tmp->next) { 123 if(tmp->next->baseaddr == baseaddr) { 123 if(tmp->next->baseaddr == baseaddr) { 124 124 break; 125 125 } … … 181 181 DWORD pAlias = (DWORD)*ppbAlias; 182 182 183 while(pAlias < (DWORD)*ppbAlias + cb) 183 while(pAlias < (DWORD)*ppbAlias + cb) 184 184 { 185 185 rc = DosQueryMem((PVOID)pAlias, &size, &attr); … … 189 189 return rc; 190 190 } 191 //Don't bother if the pages are not committed. DosSetMem will return 192 //ERROR_ACCESS_DENIED. 191 //Don't bother if the pages are not committed. DosSetMem will return 192 //ERROR_ACCESS_DENIED. 193 193 if(attr & PAG_COMMIT) { 194 194 rc = DosSetMem((PVOID)pAlias, size, fl); … … 325 325 fMemFlags = 0; 326 326 } 327 327 328 328 /* 329 329 * Let's try use the extended DosAllocMem API of Win32k.sys. … … 358 358 } 359 359 // already 64k aligned ? 360 if((ULONG) pvMemAddr & 0xFFFF) 360 if((ULONG) pvMemAddr & 0xFFFF) 361 361 { 362 362 ULONG addr64kb; … … 371 371 return rc; 372 372 } 373 373 374 374 PVOID baseAddr = (PVOID)addr64kb; // sunlover20040613: save returned address for a possible Free on failure 375 375 376 376 dprintf(("Allocate aligned memory %x -> %x", addr64kb, (addr64kb + 0xFFFF) & ~0xFFFF)); 377 377 … … 409 409 410 410 *lpAttr = 0; 411 411 412 412 if(FindAllocRec((ULONG)lpMemAddr, &ulBase, &ulSize, lpAttr) == TRUE) { 413 413 return (PVOID)ulBase; 414 414 } 415 415 416 416 ulSize = PAGE_SIZE; 417 417 rc = DosQueryMem(lpMemAddr, &ulSize, &ulAttr); … … 463 463 464 464 //Find base within previous 64kb (alignment can add filler pages) 465 for(int i=0;i<16;i++) { 465 int i; 466 for(i=0;i<16;i++) { 466 467 rc = DosQueryMem((PVOID)ulAddr, &ulSize, &ulAttr); 467 468 if(rc != NO_ERROR) { … … 482 483 } 483 484 FreeAllocRec((ULONG)lpMemAddr); 484 485 485 486 RasRemoveObject (rthVirtual, (ULONG)lpMemAddr); 486 487
Note:
See TracChangeset
for help on using the changeset viewer.