Changeset 4850 in vbox for trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
- Timestamp:
- Sep 17, 2007 8:07:47 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
r4717 r4850 52 52 * during contiguous allocations (i_ddi_mem_alloc) 53 53 */ 54 struct ddi_dma_attr g_SolarisX86PhysMemLimits = 54 struct ddi_dma_attr g_SolarisX86PhysMemLimits = 55 55 { 56 56 DMA_ATTR_V0, /* Version Number */ … … 116 116 break; 117 117 } 118 118 119 119 case RTR0MEMOBJTYPE_MAPPING: 120 120 { … … 143 143 break; 144 144 } 145 145 146 146 /* unused */ 147 147 case RTR0MEMOBJTYPE_LOW: … … 152 152 return VERR_INTERNAL_ERROR; 153 153 } 154 154 155 155 return VINF_SUCCESS; 156 156 } … … 170 170 return VERR_NO_PAGE_MEMORY; 171 171 } 172 172 173 173 pMemSolaris->Core.pv = virtAddr; 174 174 pMemSolaris->ppShadowPages = NULL; … … 189 189 { 190 190 /* Failed! Fall back to physical contiguous alloc */ 191 cmn_err(CE_NOTE, "4G boundary exceeded\n");192 191 RTR0MemObjFree(*ppMem, false); 193 192 rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable); … … 219 218 pMemSolaris->Core.pv = virtAddr; 220 219 pMemSolaris->Core.u.Cont.Phys = rtR0MemObjSolarisVirtToPhys(kas.a_hat, virtAddr); 221 pMemSolaris->ppShadowPages = NULL; 220 pMemSolaris->ppShadowPages = NULL; 222 221 *ppMem = &pMemSolaris->Core; 223 222 return VINF_SUCCESS; … … 246 245 if (!pMemSolaris) 247 246 return VERR_NO_MEMORY; 248 247 249 248 /* There is no allocation here, it needs to be mapped somewhere first */ 250 249 pMemSolaris->Core.u.Phys.fAllocated = false; … … 265 264 if (R0Process != NIL_RTR0PROCESS) 266 265 userproc = (proc_t *)R0Process; 267 266 268 267 struct as *useras = userproc->p_as; 269 268 page_t **ppl; … … 283 282 return VERR_LOCK_FAILED; 284 283 } 285 284 286 285 pMemSolaris->Core.u.Lock.R0Process = (RTR0PROCESS)userproc; 287 286 pMemSolaris->ppShadowPages = ppl; … … 300 299 caddr_t virtAddr = (caddr_t)((uintptr_t)pv & (uintptr_t)PAGEMASK); 301 300 page_t **ppl; 302 301 303 302 /* Lock down kernel pages */ 304 303 int rc = as_pagelock(&kas, &ppl, virtAddr, cb, S_WRITE); … … 336 335 int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt) 337 336 { 338 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; 337 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; 339 338 size_t size = pMemToMapSolaris->Core.cb; 340 339 void *pv = pMemToMapSolaris->Core.pv; … … 354 353 /* Use user specified address */ 355 354 addr = (caddr_t)pvFixed; 356 355 357 356 /* Blow away any previous mapping */ 358 357 as_unmap(&kas, addr, size); … … 368 367 return VERR_NO_MEMORY; 369 368 } 370 369 371 370 /* Check address against alignment, fail if it doesn't match */ 372 371 if ((uintptr_t)addr & (uAlignment - 1)) … … 377 376 } 378 377 } 379 378 380 379 /* Our protection masks are identical to <sys/mman.h> but we 381 * need to add PROT_USER for the pages to be accessible by user 380 * need to add PROT_USER for the pages to be accessible by user 382 381 */ 383 382 struct segvn_crargs crArgs = SEGVN_ZFOD_ARGS(fProt | PROT_USER, PROT_ALL); … … 389 388 return VERR_NO_MEMORY; 390 389 } 391 390 392 391 /* Map each page into kernel space */ 393 392 caddr_t kernAddr = pv; … … 411 410 int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) 412 411 { 413 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; 412 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; 414 413 size_t size = pMemToMapSolaris->Core.cb; 415 414 proc_t *userproc = (proc_t *)R0Process; … … 431 430 /* Use user specified address */ 432 431 addr = (caddr_t)R3PtrFixed; 433 432 434 433 /* Verify user address (a bit paranoid) */ 435 434 rc = valid_usr_range(addr, size, fProt, useras, (caddr_t)USERLIMIT32); … … 440 439 return VERR_INVALID_POINTER; 441 440 } 442 441 443 442 /* Blow away any previous mapping */ 444 443 as_unmap(useras, addr, size); … … 454 453 return VERR_MAP_FAILED; 455 454 } 456 455 457 456 /* Check address against alignment, fail if it doesn't match */ 458 457 if ((uintptr_t)addr & (uAlignment - 1)) … … 463 462 } 464 463 } 465 464 466 465 /* Our protection masks are identical to <sys/mman.h> but we 467 * need to add PROT_USER for the pages to be accessible by user 466 * need to add PROT_USER for the pages to be accessible by user 468 467 */ 469 468 struct segvn_crargs crArgs = SEGVN_ZFOD_ARGS(fProt | PROT_USER, PROT_ALL); … … 542 541 else /* Kernel */ 543 542 hatSpace = kas.a_hat; 544 543 545 544 uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT); 546 545 return rtR0MemObjSolarisVirtToPhys(hatSpace, pb);
Note:
See TracChangeset
for help on using the changeset viewer.