Changeset 40916 in vbox
- Timestamp:
- Apr 14, 2012 7:53:26 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
r39744 r40916 192 192 { 193 193 vm_page_t pPages; 194 int cTries = 0; 195 194 196 #if __FreeBSD_version > 1000000 195 197 int fFlags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY; 196 198 if (fWire) 197 199 fFlags |= VM_ALLOC_WIRED; 198 VM_OBJECT_LOCK(pObject); 199 pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); 200 VM_OBJECT_UNLOCK(pObject); 200 201 while (cTries <= 1) 202 { 203 VM_OBJECT_LOCK(pObject); 204 pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, 205 VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); 206 VM_OBJECT_UNLOCK(pObject); 207 if (pPages) 208 break; 209 vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh); 210 cTries++; 211 } 212 201 213 return pPages; 202 214 #else 203 pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); 215 while (cTries <= 1) 216 { 217 pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); 218 if (pPages) 219 break; 220 vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh); 221 cTries++; 222 } 223 204 224 if (!pPages) 205 225 return pPages; … … 260 280 vm_paddr_t VmPhysAddrHigh, bool fContiguous, int rcNoMem) 261 281 { 262 int rc; 263 size_t cPages = atop(pMemFreeBSD->Core.cb); 282 vm_offset_t MapAddress = vm_map_min(kernel_map); 283 size_t cPages = atop(pMemFreeBSD->Core.cb); 284 int rc; 264 285 265 286 pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); 266 vm_offset_t MapAddress;267 287 268 288 /* No additional object reference for auto-deallocation upon unmapping. */ … … 288 308 vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb); 289 309 } 290 rc = rcNoMem; /** @todo fix translation (borrow from darwin) */ 291 292 vm_object_deallocate(pMemFreeBSD->pObject); 310 else 311 { 312 rc = rcNoMem; /** @todo fix translation (borrow from darwin) */ 313 vm_object_deallocate(pMemFreeBSD->pObject); 314 } 315 293 316 rtR0MemObjDelete(&pMemFreeBSD->Core); 294 317 return rc; … … 320 343 return VERR_NO_MEMORY; 321 344 322 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G , false, VERR_NO_LOW_MEMORY);345 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false, VERR_NO_LOW_MEMORY); 323 346 if (RT_FAILURE(rc)) 324 347 { … … 339 362 return VERR_NO_MEMORY; 340 363 341 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G , true, VERR_NO_CONT_MEMORY);364 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true, VERR_NO_CONT_MEMORY); 342 365 if (RT_FAILURE(rc)) 343 366 {
Note:
See TracChangeset
for help on using the changeset viewer.