Changeset 4049 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Aug 7, 2007 1:45:14 AM (17 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/freebsd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
r4038 r4049 55 55 /** The core structure. */ 56 56 RTR0MEMOBJINTERNAL Core; 57 #if 0 58 /** Lock for the ring-3 / ring-0 pinned objectes. 59 * This member might not be allocated for some object types. */ 60 KernVMLock_t Lock; 61 /** Array of physical pages. 62 * This array can be 0 in length for some object types. */ 63 KernPageList_t aPages[1]; 64 #endif 57 /** The VM object associated with the allocation. */ 58 vm_object_t pObject; 59 /** the VM object associated with the mapping. 60 * In mapping mem object, this is the shadow object? 61 * In a allocation/enter mem object, this is the shared object we constructed (contig, perhaps alloc). */ 62 vm_object_t pMappingObject; 65 63 } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD; 66 64 … … 76 74 { 77 75 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem; 78 //int rc;76 int rc; 79 77 80 78 switch (pMemFreeBSD->Core.enmType) 81 79 { 82 80 case RTR0MEMOBJTYPE_CONT: 83 contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTCONT); 84 break; 85 86 #if 0 81 contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTMOBJ); 82 if (pMemFreeBSD->pMappingObject) 83 { 84 rc = vm_map_remove(kernel_map, 85 (vm_offset_t)pMemFreeBSD->Core.pv, 86 (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); 87 AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); 88 } 89 break; 90 91 case RTR0MEMOBJTYPE_PAGE: 92 if (pMemFreeBSD->pObject) 93 { 94 rc = vm_map_remove(kernel_map, 95 (vm_offset_t)pMemFreeBSD->Core.pv, 96 (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); 97 AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); 98 } 99 else 100 { 101 free(pMemFreeBSD->Core.pv, M_IPRTMOBJ); 102 if (pMemFreeBSD->pMappingObject) 103 { 104 rc = vm_map_remove(kernel_map, 105 (vm_offset_t)pMemFreeBSD->Core.pv, 106 (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); 107 AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); 108 } 109 } 110 break; 111 112 case RTR0MEMOBJTYPE_LOCK: 113 { 114 vm_map_t pMap = kernel_map; 115 if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) 116 pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map; 117 rc = vm_map_unwire(pMap, 118 (vm_offset_t)pMemFreeBSD->Core.pv, 119 (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb, 120 VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); 121 AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); 122 break; 123 } 124 125 case RTR0MEMOBJTYPE_RES_VIRT: 126 { 127 vm_map_t pMap = kernel_map; 128 if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) 129 pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map; 130 rc = vm_map_remove(pMap, 131 (vm_offset_t)pMemFreeBSD->Core.pv, 132 (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); 133 AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); 134 break; 135 } 136 137 case RTR0MEMOBJTYPE_MAPPING: 138 { 139 /** @todo Figure out mapping... */ 140 } 141 142 /* unused: */ 143 case RTR0MEMOBJTYPE_LOW: 87 144 case RTR0MEMOBJTYPE_PHYS: 88 //if (!pMemFreeBSD->Core.pv)89 // break;90 break91 92 case RTR0MEMOBJTYPE_MAPPING:93 //if (pMemFreeBSD->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)94 // break;95 break;96 97 case RTR0MEMOBJTYPE_PAGE:98 case RTR0MEMOBJTYPE_LOW:99 //rc = KernVMFree(pMemFreeBSD->Core.pv);100 //AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemFreeBSD->Core.enmType, pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb));101 break;102 103 case RTR0MEMOBJTYPE_LOCK:104 //rc = KernVMUnlock(&pMemFreeBSD->Lock);105 //AssertMsg(!rc, ("rc=%d\n", rc));106 break;107 108 case RTR0MEMOBJTYPE_RES_VIRT:109 #endif110 145 default: 111 146 AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType)); 112 147 return VERR_INTERNAL_ERROR; 113 148 } 149 150 Assert(!pMemFreeBSD->pMappingObject); 114 151 115 152 return VINF_SUCCESS; … … 119 156 int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) 120 157 { 121 /* malloc or like the linker: http://fxr.watson.org/fxr/source/kern/link_elf.c?v=RELENG62#L701 */122 #if 0 158 int rc; 159 123 160 /* create the object. */ 124 const ULONG cPages = cb >> PAGE_SHIFT;125 161 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_PAGE, NULL, cb); 126 162 if (!pMemFreeBSD) 127 163 return VERR_NO_MEMORY; 128 129 /* do the allocation. */ 130 int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL); 131 if (!rc) 132 { 133 ULONG cPagesRet = cPages; 134 rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet); 135 if (!rc) 164 165 /* 166 * We've two options here both expressed nicely by how kld allocates 167 * memory for the module bits: 168 * http://fxr.watson.org/fxr/source/kern/link_elf.c?v=RELENG62#L701 169 */ 170 #if 0 171 pMemFreeBSD->Core.pv = malloc(cb, M_IPRTMOBJ, M_ZERO); 172 if (pMemFreeBSD->Core.pv) 173 { 174 *ppMem = &pMemFreeBSD->Core; 175 return VINF_SUCCESS; 176 } 177 rc = VERR_NO_MEMORY; 178 NOREF(fExecutable); 179 180 #else 181 pMemFreeBSD->pObject = vm_object_allocate(OBJT_DEFAULT, cb >> PAGE_SHIFT); 182 if (pMemFreeBSD->pObject) 183 { 184 vm_offset_t MapAddress = vm_map_min(kernel_map); 185 rc = vm_map_find(kernel_map, /* map */ 186 pMemFreeBSD->pObject, /* object */ 187 0, /* offset */ 188 &MapAddress, /* addr (IN/OUT) */ 189 cb, /* length */ 190 TRUE, /* find_space */ 191 fExecutable /* protection */ 192 ? VM_PROT_ALL 193 : VM_PROT_RW, 194 VM_PROT_ALL, /* max(_prot) */ 195 FALSE); /* cow (copy-on-write) */ 196 if (rc == KERN_SUCCESS) 136 197 { 137 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 138 *ppMem = &pMemFreeBSD->Core; 139 return VINF_SUCCESS; 198 rc = vm_map_wire(kernel_map, /* map */ 199 MapAddress, /* start */ 200 MapAddress + cb, /* end */ 201 VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); 202 if (rc == KERN_SUCCESS) 203 { 204 pMemFreeBSD->Core.pv = (void *)MapAddress; 205 *ppMem = &pMemFreeBSD->Core; 206 return VINF_SUCCESS; 207 } 208 209 vm_map_remove(kernel_map, 210 MapAddress, 211 MapAddress + cb); 140 212 } 141 KernVMFree(pMemFreeBSD->Core.pv); 142 } 213 else 214 vm_object_deallocate(pMemFreeBSD->pObject); 215 rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ 216 } 217 else 218 rc = VERR_NO_MEMORY; 219 #endif 220 143 221 rtR0MemObjDelete(&pMemFreeBSD->Core); 144 NOREF(fExecutable); 145 return RTErrConvertFromOS2(rc); 146 #else 147 return VERR_NOT_IMPLEMENTED; 148 #endif 222 return rc; 149 223 } 150 224 … … 152 226 int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) 153 227 { 154 /* same as Alloc and hope we're lucky, make sure to verify the physical addresses */ 155 NOREF(fExecutable); 156 157 #if 0 158 /* create the object. */ 159 const ULONG cPages = cb >> PAGE_SHIFT; 160 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb); 161 if (!pMemFreeBSD) 162 return VERR_NO_MEMORY; 163 164 /* do the allocation. */ 165 int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL); 166 if (!rc) 167 { 168 ULONG cPagesRet = cPages; 169 rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet); 170 if (!rc) 171 { 172 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 173 *ppMem = &pMemFreeBSD->Core; 174 return VINF_SUCCESS; 175 } 176 KernVMFree(pMemFreeBSD->Core.pv); 177 } 178 rtR0MemObjDelete(&pMemFreeBSD->Core); 179 return RTErrConvertFromOS2(rc); 180 #endif 181 return VERR_NOT_IMPLEMENTED; 228 /* 229 * Try a Alloc first and see if we get luck, if not try contigmalloc. 230 * Might wish to try find our own pages or something later if this 231 * turns into a problemspot on AMD64 boxes. 232 */ 233 int rc = rtR0MemObjNativeAllocPage(ppMem, cb, fExecutable); 234 if (RT_SUCCESS(rc)) 235 { 236 size_t iPage = cb >> PAGE_SHIFT; 237 while (iPage-- > 0) 238 if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) > (_4G - PAGE_SIZE)) 239 { 240 RTR0MemObjFree(*ppMem, false); 241 *ppMem = NULL; 242 rc = VERR_NO_MEMORY; 243 break; 244 } 245 } 246 if (RT_FAILURE(rc)) 247 rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable); 248 return rc; 182 249 } 183 250 … … 213 280 int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) 214 281 { 215 AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%VHp\n", PhysHighest), VERR_NOT_IMPLEMENTED); 216 217 #if 0 282 /** @todo check if there is a more appropriate API somewhere.. */ 283 218 284 /* create the object. */ 219 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew( RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb);285 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); 220 286 if (!pMemFreeBSD) 221 287 return VERR_NO_MEMORY; 222 288 223 289 /* do the allocation. */ 224 ULONG ulPhys = ~0UL; 225 int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL); 226 if (!rc) 227 { 228 Assert(ulPhys != ~0UL); 229 pMemFreeBSD->Core.u.Phys.fAllocated = true; 230 pMemFreeBSD->Core.u.Phys.PhysBase = ulPhys; 290 pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ 291 M_IPRTMOBJ, /* type */ 292 M_NOWAIT | M_ZERO, /* flags */ 293 0, /* lowest physical address*/ 294 PhysHighest, /* highest physical address */ 295 PAGE_SIZE, /* alignment. */ 296 0); /* boundrary */ 297 if (pMemFreeBSD->Core.pv) 298 { 299 pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); 231 300 *ppMem = &pMemFreeBSD->Core; 232 301 return VINF_SUCCESS; 233 302 } 303 234 304 rtR0MemObjDelete(&pMemFreeBSD->Core); 235 return RTErrConvertFromOS2(rc); 236 #endif 237 return VERR_NOT_IMPLEMENTED; 305 return VERR_NO_MEMORY; 238 306 } 239 307 … … 256 324 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process) 257 325 { 258 /* see vslock and vsunlock */ 259 #if 0 260 AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); 326 int rc; 261 327 262 328 /* create the object. */ 263 const ULONG cPages = cb >> PAGE_SHIFT; 264 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb); 329 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOCK, pv, cb); 265 330 if (!pMemFreeBSD) 266 331 return VERR_NO_MEMORY; 267 268 /* lock it. */ 269 ULONG cPagesRet = cPages; 270 int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet); 271 if (!rc) 272 { 273 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 274 Assert(cb == pMemFreeBSD->Core.cb); 275 Assert(pv == pMemFreeBSD->Core.pv); 332 333 /* 334 * We could've used vslock here, but we don't wish to be subject to 335 * resource usage restrictions, so we'll call vm_map_wire directly. 336 */ 337 rc = vm_map_wire(&((struct proc *)R0Process)->p_vmspace->vm_map, /* the map */ 338 (vm_offset_t)pv, /* start */ 339 (vm_offset_t)pv + cb, /* end */ 340 VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); /* flags - SYSTEM? */ 341 if (rc == KERN_SUCCESS) 342 { 276 343 pMemFreeBSD->Core.u.Lock.R0Process = R0Process; 277 344 *ppMem = &pMemFreeBSD->Core; … … 279 346 } 280 347 rtR0MemObjDelete(&pMemFreeBSD->Core); 281 return RTErrConvertFromOS2(rc); 282 #endif 283 return VERR_NOT_IMPLEMENTED; 348 return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */ 284 349 } 285 350 … … 287 352 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb) 288 353 { 289 #if 0 354 int rc; 355 290 356 /* create the object. */ 291 const ULONG cPages = cb >> PAGE_SHIFT; 292 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb); 357 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOCK, pv, cb); 293 358 if (!pMemFreeBSD) 294 359 return VERR_NO_MEMORY; 295 360 296 /* lock it. */ 297 ULONG cPagesRet = cPages; 298 int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet); 299 if (!rc) 300 { 301 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 361 /* lock the memory */ 362 rc = vm_map_wire(kernel_map, /* the map */ 363 (vm_offset_t)pv, /* start */ 364 (vm_offset_t)pv + cb, /* end */ 365 VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); /* flags - SYSTEM? */ 366 if (rc == KERN_SUCCESS) 367 { 302 368 pMemFreeBSD->Core.u.Lock.R0Process = NIL_RTR0PROCESS; 303 369 *ppMem = &pMemFreeBSD->Core; … … 305 371 } 306 372 rtR0MemObjDelete(&pMemFreeBSD->Core); 307 return RTErrConvertFromOS2(rc); 308 #endif 309 return VERR_NOT_IMPLEMENTED; 310 } 311 373 return VERR_NO_MEMORY;/** @todo fix mach -> vbox error conversion for freebsd. */ 374 } 375 376 377 /** 378 * Worker for the two virtual address space reservers. 379 * 380 * We're leaning on the examples provided by mmap and vm_mmap in vm_mmap.c here. 381 */ 382 static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, vm_map_t pMap) 383 { 384 int rc; 385 386 /* 387 * The pvFixed address range must be within the VM space when specified. 388 */ 389 if (pvFixed != (void *)-1 390 && ( (vm_offset_t)pvFixed < vm_map_min(pMap) 391 || (vm_offset_t)pvFixed + cb > vm_map_max(pMap))) 392 return VERR_INVALID_PARAMETER; 393 394 /* 395 * Create the object. 396 */ 397 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_RES_VIRT, NULL, cb); 398 if (!pMemFreeBSD) 399 return VERR_NO_MEMORY; 400 401 /* 402 * Allocate an empty VM object and map it into the requested map. 403 */ 404 pMemFreeBSD->pObject = vm_object_allocate(OBJT_DEFAULT, cb >> PAGE_SHIFT); 405 if (pMemFreeBSD->pObject) 406 { 407 vm_offset_t MapAddress = pvFixed != (void *)-1 408 ? (vm_offset_t)pvFixed 409 : vm_map_min(kernel_map); 410 if (pvFixed) 411 vm_map_remove(pMap, 412 MapAddress, 413 MapAddress + cb); 414 415 rc = vm_map_find(pMap, /* map */ 416 pMemFreeBSD->pObject, /* object */ 417 0, /* offset */ 418 &MapAddress, /* addr (IN/OUT) */ 419 cb, /* length */ 420 pvFixed == (void *)-1, /* find_space */ 421 VM_PROT_NONE, /* protection */ 422 VM_PROT_ALL, /* max(_prot) ?? */ 423 FALSE); /* cow (copy-on-write) */ 424 if (rc == KERN_SUCCESS) 425 { 426 if (R0Process != NIL_RTR0PROCESS) 427 { 428 rc = vm_map_inherit(pMap, 429 MapAddress, 430 MapAddress + cb, 431 VM_INHERIT_SHARE); 432 AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); 433 } 434 pMemFreeBSD->Core.pv = (void *)MapAddress; 435 pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; 436 *ppMem = &pMemFreeBSD->Core; 437 return VINF_SUCCESS; 438 } 439 vm_object_deallocate(pMemFreeBSD->pObject); 440 rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ 441 } 442 else 443 rc = VERR_NO_MEMORY; 444 rtR0MemObjDelete(&pMemFreeBSD->Core); 445 return rc; 446 447 } 312 448 313 449 int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) 314 450 { 315 /* see kmem_alloc_nofault */ 316 return VERR_NOT_IMPLEMENTED; 451 return rtR0MemObjNativeReserveInMap(ppMem, pvFixed, cb, uAlignment, NIL_RTR0PROCESS, kernel_map); 317 452 } 318 453 … … 320 455 int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) 321 456 { 322 /* see kmem_alloc_nofault */323 return VERR_NOT_IMPLEMENTED;457 return rtR0MemObjNativeReserveInMap(ppMem, pvFixed, cb, uAlignment, R0Process, 458 &((struct proc *)R0Process)->p_vmspace->vm_map); 324 459 } 325 460 … … 491 626 switch (pMemFreeBSD->Core.enmType) 492 627 { 628 case RTR0MEMOBJTYPE_LOCK: 629 { 630 if ( pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS 631 && pMemFreeBSD->Core.u.Lock.R0Process != (RTR0PROCESS)curproc) 632 { 633 /* later */ 634 return NIL_RTHCPHYS; 635 } 636 } 493 637 case RTR0MEMOBJTYPE_PAGE: 494 case RTR0MEMOBJTYPE_LOW:495 case RTR0MEMOBJTYPE_LOCK:496 // return pMemFreeBSD->aPages[iPage].Addr;497 return NIL_RTHCPHYS; 498 638 { 639 uint8_t *pb = (uint8_t *)pMemFreeBSD->Core.pv + ((size_t)iPage << PAGE_SHIFT); 640 return vtophys(pb); 641 } 642 499 643 case RTR0MEMOBJTYPE_CONT: 500 644 return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); … … 505 649 case RTR0MEMOBJTYPE_RES_VIRT: 506 650 case RTR0MEMOBJTYPE_MAPPING: 651 case RTR0MEMOBJTYPE_LOW: 507 652 default: 508 653 return NIL_RTHCPHYS; -
trunk/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
r3977 r4049 53 53 #include <sys/sched.h> 54 54 #include <sys/callout.h> 55 #include <vm/vm.h> /* for vtophys */55 #include <vm/vm.h> 56 56 #include <vm/pmap.h> /* for vtophys */ 57 #include <vm/vm_map.h> 58 #include <vm/vm_object.h> 59 #include <vm/vm_kern.h> 60 #include <vm/vm_param.h> /* KERN_SUCCESS ++ */ 57 61 58 62 /*#ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.