Changeset 43366 in vbox for trunk/src/VBox/Runtime/r0drv/haiku/memobj-r0drv-haiku.c
- Timestamp:
- Sep 20, 2012 12:31:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/haiku/memobj-r0drv-haiku.c
r43363 r43366 78 78 case RTR0MEMOBJTYPE_LOCK: 79 79 return pMem->u.Lock.R0Process == NIL_RTR0PROCESS 80 81 80 ? kernel_map 81 : &((struct proc *)pMem->u.Lock.R0Process)->p_vmspace->vm_map; 82 82 83 83 case RTR0MEMOBJTYPE_RES_VIRT: 84 84 return pMem->u.ResVirt.R0Process == NIL_RTR0PROCESS 85 86 85 ? kernel_map 86 : &((struct proc *)pMem->u.ResVirt.R0Process)->p_vmspace->vm_map; 87 87 88 88 case RTR0MEMOBJTYPE_MAPPING: 89 89 return pMem->u.Mapping.R0Process == NIL_RTR0PROCESS 90 91 90 ? kernel_map 91 : &((struct proc *)pMem->u.Mapping.R0Process)->p_vmspace->vm_map; 92 92 93 93 default: … … 150 150 151 151 static int rtR0MemObjNativeAllocArea(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, 152 bool fExecutable, RTR0MEMOBJTYPE type, RTHCPHYS PhysHighest, size_t uAlignment)152 bool fExecutable, RTR0MEMOBJTYPE type, RTHCPHYS PhysHighest, size_t uAlignment) 153 153 { 154 154 NOREF(fExecutable); … … 159 159 uint32 addressSpec = B_ANY_KERNEL_ADDRESS; 160 160 uint32 fLock = ~0U; 161 LogFlowFunc(("ppMem=%p cb=%u, fExecutable=%s, type=%08x, PhysHighest=%RX64 uAlignment=%u\n", ppMem, 162 fExecutable ? "true" : "false", type, PhysHighest,(unsigned)uAlignment));161 LogFlowFunc(("ppMem=%p cb=%u, fExecutable=%s, type=%08x, PhysHighest=%RX64 uAlignment=%u\n", ppMem,(unsigned)cb, 162 fExecutable ? "true" : "false", type, PhysHighest,(unsigned)uAlignment)); 163 163 164 164 switch (type) … … 194 194 case RTR0MEMOBJTYPE_LOCK: 195 195 break; 196 #endif 196 #endif 197 197 default: 198 198 return VERR_INTERNAL_ERROR; … … 237 237 } 238 238 239 239 delete_area(pMemHaiku->AreaId); 240 240 } 241 241 … … 277 277 { 278 278 AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); 279 LogFlowFunc(("ppMem=%p Phys=%08x cb=%u uCachePolicy=%x\n", ppMem, Phys, 279 LogFlowFunc(("ppMem=%p Phys=%08x cb=%u uCachePolicy=%x\n", ppMem, Phys,(unsigned)cb, uCachePolicy)); 280 280 281 281 /* Create the object. */ … … 315 315 316 316 LogFlowFunc(("ppMem=%p pvStart=%p cb=%u fAccess=%x R0Process=%d fFlags=%x\n", ppMem, pvStart, cb, fAccess, R0Process, 317 fFlags));317 fFlags)); 318 318 319 319 /* Create the object. */ … … 365 365 366 366 if (R0Process != NIL_RTR0PROCESS) 367 367 team = (team_id)R0Process; 368 368 369 369 /* Check that the specified alignment is supported. */ 370 370 if (uAlignment > PAGE_SIZE) 371 371 return VERR_NOT_SUPPORTED; 372 372 373 373 /* Create the object. */ 374 374 PRTR0MEMOBJHAIKU pMemHaiku = (PRTR0MEMOBJHAIKU)rtR0MemObjNew(sizeof(*pMemHaiku), RTR0MEMOBJTYPE_RES_VIRT, NULL, cb); 375 375 if (!pMemHaiku) 376 376 return VERR_NO_MEMORY; 377 377 378 378 /* Ask the kernel to reserve the address range. */ … … 410 410 /** @todo r=ramshankar: Wrong format specifiers, fix later! */ 411 411 dprintf("%s(%p, %p, %p, %d, %x, %u, %u)\n", __FUNCTION__, ppMem, pMemToMap, pvFixed, uAlignment, 412 fProt, offSub, cbSub);412 fProt, offSub, cbSub); 413 413 #endif 414 414 /* Check that the specified alignment is supported. */ … … 436 436 rc = area = clone_area("IPRT R0MemObj MapKernel", &pvMap, uAddrSpec, fProtect, pMemToMapHaiku->AreaId); 437 437 LogFlow(("rtR0MemObjNativeMapKernel: clone_area uAddrSpec=%d fProtect=%x AreaId=%d rc=%d\n", uAddrSpec, fProtect, 438 pMemToMapHaiku->AreaId, rc));438 pMemToMapHaiku->AreaId, rc)); 439 439 } 440 440 else if (pMemToMapHaiku->Core.enmType == RTR0MEMOBJTYPE_PHYS) … … 457 457 pMemToMapHaiku->Core.cb); 458 458 if (RT_UNLIKELY(!pMemHaiku)) 459 459 return VERR_NO_MEMORY; 460 460 461 461 pMemHaiku->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; … … 483 483 AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED); 484 484 if (uAlignment > PAGE_SIZE) 485 485 return VERR_NOT_SUPPORTED; 486 486 487 487 int rc; … … 493 493 vm_prot_t ProtectionFlags = 0; 494 494 if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE) 495 495 ProtectionFlags = VM_PROT_NONE; 496 496 if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ) 497 497 ProtectionFlags |= VM_PROT_READ; 498 498 if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE) 499 499 ProtectionFlags |= VM_PROT_WRITE; 500 500 if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC) 501 501 ProtectionFlags |= VM_PROT_EXECUTE; 502 502 503 503 /* calc mapping address */ … … 562 562 */ 563 563 PRTR0MEMOBJHAIKU pMemHaiku = (PRTR0MEMOBJHAIKU)rtR0MemObjNew(sizeof(RTR0MEMOBJHAIKU), 564 565 566 564 RTR0MEMOBJTYPE_MAPPING, 565 (void *)AddrR3, 566 pMemToMap->cb); 567 567 if (pMemHaiku) 568 568 { … … 591 591 PRTR0MEMOBJHAIKU pMemHaiku = (PRTR0MEMOBJHAIKU)pMem; 592 592 status_t rc; 593 593 594 594 /** @todo r=ramshankar: Validate objects */ 595 596 LogFlow(("rtR0MemObjNativeGetPagePhysAddr: pMem=%p enmType=%x iPage=%u\n", pMem, pMemHaiku->Core.enmType, 595 596 LogFlow(("rtR0MemObjNativeGetPagePhysAddr: pMem=%p enmType=%x iPage=%u\n", pMem, pMemHaiku->Core.enmType,(unsigned)iPage)); 597 597 598 598 switch (pMemHaiku->Core.enmType) … … 602 602 team_id TeamId = B_SYSTEM_TEAM; 603 603 physical_entry aPhysMap[2]; 604 int32 cPhysMap = 2; 604 int32 cPhysMap = 2; /** @todo r=ramshankar: why not use RT_ELEMENTS? */ 605 605 606 606 if (pMemHaiku->Core.u.Lock.R0Process != NIL_RTR0PROCESS) … … 643 643 team_id TeamId = B_SYSTEM_TEAM; 644 644 physical_entry aPhysMap[2]; 645 int32 cPhysMap = 2; 645 int32 cPhysMap = 2; /** @todo r=ramshankar: why not use RT_ELEMENTS? */ 646 646 647 647 void *pb = pMemHaiku->Core.pv + (iPage << PAGE_SHIFT);
Note:
See TracChangeset
for help on using the changeset viewer.