Changeset 4717 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Sep 12, 2007 6:44:18 AM (17 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/solaris
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c
r4071 r4717 37 37 #endif 38 38 39 printf("\r\n!!Assertion Failed!!\r\n"40 "Expression: %s\r\n"41 "Location : %s(%d) %s\r\n",42 pszExpr, pszFile, uLine, pszFunction);39 uprintf("\r\n!!Assertion Failed!!\r\n" 40 "Expression: %s\r\n" 41 "Location : %s(%d) %s\r\n", 42 pszExpr, pszFile, uLine, pszFunction); 43 43 } 44 44 … … 59 59 szMsg[sizeof(szMsg) - 1] = '\0'; 60 60 va_end(va); 61 printf("%s", szMsg);61 uprintf("%s", szMsg); 62 62 } 63 63 -
trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
r4474 r4717 101 101 102 102 case RTR0MEMOBJTYPE_PAGE: 103 kmem_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);103 ddi_umem_free(pMemSolaris->Cookie); 104 104 break; 105 105 … … 107 107 { 108 108 cmn_err(CE_NOTE, "rtR0MemObjNativeFree: LOCK\n"); 109 struct as *addrSpace;109 struct as *addrSpace; 110 110 if (pMemSolaris->Core.u.Lock.R0Process == NIL_RTR0PROCESS) 111 111 addrSpace = &kas; … … 119 119 case RTR0MEMOBJTYPE_MAPPING: 120 120 { 121 struct hat *hatSpace;122 struct as *addrSpace;121 struct hat *hatSpace; 122 struct as *addrSpace; 123 123 cmn_err(CE_NOTE, "rtR0MemObjNativeFree: MAPPING\n"); 124 124 if (pMemSolaris->Core.u.Mapping.R0Process == NIL_RTR0PROCESS) … … 164 164 return VERR_NO_MEMORY; 165 165 166 /** @todo r=bird: The man page says: "The allocated memory is at least double-word aligned, so it can hold any C data structure. No greater alignment can be assumed." */ 167 void* virtAddr = kmem_alloc(cb, KM_SLEEP); 166 void *virtAddr = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie); 168 167 if (!virtAddr) 169 168 { 170 169 rtR0MemObjDelete(&pMemSolaris->Core); 171 return VERR_NO_ MEMORY;170 return VERR_NO_PAGE_MEMORY; 172 171 } 173 172 … … 215 214 { 216 215 rtR0MemObjDelete(&pMemSolaris->Core); 217 return VERR_NO_ MEMORY;216 return VERR_NO_CONT_MEMORY; 218 217 } 219 218 … … 258 257 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process) 259 258 { 260 /* Create the object */259 /* Create the locking object */ 261 260 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb); 262 261 if (!pMemSolaris) … … 270 269 page_t **ppl; 271 270 271 /* Lock down user pages */ 272 272 int rc = as_pagelock(useras, &ppl, (caddr_t)R3Ptr, cb, S_WRITE); 273 273 if (rc != 0) 274 274 { 275 275 cmn_err(CE_NOTE,"rtR0MemObjNativeLockUser: as_pagelock failed rc=%d\n", rc); 276 return VERR_ NO_MEMORY;276 return VERR_LOCK_FAILED; 277 277 } 278 278 … … 281 281 as_pageunlock(useras, ppl, (caddr_t)R3Ptr, cb, S_WRITE); 282 282 cmn_err(CE_NOTE, "rtR0MemObjNativeLockUser: as_pagelock failed to get shadow pages\n"); 283 return VERR_ NO_MEMORY;283 return VERR_LOCK_FAILED; 284 284 } 285 285 … … 293 293 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb) 294 294 { 295 /* Create the object */295 /* Create the locking object */ 296 296 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_LOCK, pv, cb); 297 297 if (!pMemSolaris) … … 301 301 page_t **ppl; 302 302 303 /* Lock down kernel pages */ 303 304 int rc = as_pagelock(&kas, &ppl, virtAddr, cb, S_WRITE); 304 305 if (rc != 0) 305 return VERR_NO_MEMORY; 306 { 307 cmn_err(CE_NOTE,"rtR0MemObjNativeLockKernel: as_pagelock failed rc=%d\n", rc); 308 return VERR_LOCK_FAILED; 309 } 306 310 307 311 if (!ppl) 308 312 { 309 313 as_pageunlock(&kas, ppl, virtAddr, cb, S_WRITE); 310 cmn_err(CE_NOTE, "rtR0MemObjNativeLock User: failed to get shadow pages\n");311 return VERR_ NO_MEMORY;314 cmn_err(CE_NOTE, "rtR0MemObjNativeLockKernel: failed to get shadow pages\n"); 315 return VERR_LOCK_FAILED; 312 316 } 313 317 … … 333 337 { 334 338 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; 335 size_t size = P2ROUNDUP(pMemToMapSolaris->Core.cb, PAGE_SIZE); /* r=bird: not necessary, see the specs / caller implementation. */339 size_t size = pMemToMapSolaris->Core.cb; 336 340 void *pv = pMemToMapSolaris->Core.pv; 337 341 pgcnt_t cPages = btop(size); … … 364 368 return VERR_NO_MEMORY; 365 369 } 366 /** @todo r=bird: check address against uAlignment, just fail if it's not matching. */ 370 371 /* Check address against alignment, fail if it doesn't match */ 372 if ((uintptr_t)addr & (uAlignment - 1)) 373 { 374 as_rangeunlock(&kas); 375 cmn_err(CE_NOTE, "rtR0MemObjNativeMapKernel: map_addr alignment(%ld) failed.\n", uAlignment); 376 return VERR_MAP_FAILED; 377 } 367 378 } 368 379 … … 401 412 { 402 413 PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; 403 size_t size = P2ROUNDUP(pMemToMapSolaris->Core.cb, PAGE_SIZE); /** @todo r=bird: this isn't necessary, see the specs. */414 size_t size = pMemToMapSolaris->Core.cb; 404 415 proc_t *userproc = (proc_t *)R0Process; 405 416 struct as *useras = userproc->p_as; … … 441 452 as_rangeunlock(useras); 442 453 cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: map_addr failed\n"); 443 return VERR_NO_MEMORY; 444 } 445 446 /** @todo r=bird: check address against uAlignment, just fail if it's not matching. */ 454 return VERR_MAP_FAILED; 455 } 456 457 /* Check address against alignment, fail if it doesn't match */ 458 if ((uintptr_t)addr & (uAlignment - 1)) 459 { 460 as_rangeunlock(useras); 461 cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: map_addr alignment(%ld) failed.\n", uAlignment); 462 return VERR_MAP_FAILED; 463 } 447 464 } 448 465 … … 456 473 { 457 474 cmn_err(CE_NOTE, "rtR0MemObjNativeMapUser: as_map failure.\n"); 458 return VERR_ NO_MEMORY;475 return VERR_MAP_FAILED; 459 476 } 460 477
Note:
See TracChangeset
for help on using the changeset viewer.