Changeset 3977 in vbox for trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
- Timestamp:
- Aug 2, 2007 12:37:43 AM (17 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
r3911 r3977 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Ring-0 Memory Objects, OS/2.3 * innotek Portable Runtime - Ring-0 Memory Objects, FreeBSD. 4 4 */ 5 5 … … 33 33 * Header Files * 34 34 *******************************************************************************/ 35 #include "the- os2-kernel.h"35 #include "the-freebsd-kernel.h" 36 36 37 37 #include <iprt/memobj.h> … … 49 49 *******************************************************************************/ 50 50 /** 51 * The OS/2version of the memory object structure.51 * The FreeBSD version of the memory object structure. 52 52 */ 53 typedef struct RTR0MEMOBJ DARWIN53 typedef struct RTR0MEMOBJFREEBSD 54 54 { 55 55 /** The core structure. */ 56 56 RTR0MEMOBJINTERNAL Core; 57 #if 0 57 58 /** Lock for the ring-3 / ring-0 pinned objectes. 58 59 * This member might not be allocated for some object types. */ … … 61 62 * This array can be 0 in length for some object types. */ 62 63 KernPageList_t aPages[1]; 63 } RTR0MEMOBJOS2, *PRTR0MEMOBJOS2; 64 #endif 65 } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD; 64 66 65 67 … … 67 69 * Internal Functions * 68 70 *******************************************************************************/ 69 static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet);70 71 71 72 72 73 int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) 73 74 { 74 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;75 int rc;76 77 switch (pMem Os2->Core.enmType)75 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem; 76 // int rc; 77 78 switch (pMemFreeBSD->Core.enmType) 78 79 { 79 80 case RTR0MEMOBJTYPE_PHYS: 80 if (!pMem Os2->Core.pv)81 if (!pMemFreeBSD->Core.pv) 81 82 break; 82 83 83 84 case RTR0MEMOBJTYPE_MAPPING: 84 if (pMem Os2->Core.u.Mapping.R0Process == NIL_RTR0PROCESS)85 if (pMemFreeBSD->Core.u.Mapping.R0Process == NIL_RTR0PROCESS) 85 86 break; 86 87 … … 89 90 case RTR0MEMOBJTYPE_LOW: 90 91 case RTR0MEMOBJTYPE_CONT: 91 rc = KernVMFree(pMemOs2->Core.pv);92 AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemOs2->Core.enmType, pMemOs2->Core.pv, pMemOs2->Core.cb));92 //rc = KernVMFree(pMemFreeBSD->Core.pv); 93 //AssertMsg(!rc, ("rc=%d type=%d pv=%p cb=%#zx\n", rc, pMemFreeBSD->Core.enmType, pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb)); 93 94 break; 94 95 95 96 case RTR0MEMOBJTYPE_LOCK: 96 rc = KernVMUnlock(&pMemOs2->Lock);97 AssertMsg(!rc, ("rc=%d\n", rc));97 //rc = KernVMUnlock(&pMemFreeBSD->Lock); 98 //AssertMsg(!rc, ("rc=%d\n", rc)); 98 99 break; 99 100 100 101 case RTR0MEMOBJTYPE_RES_VIRT: 101 102 default: 102 AssertMsgFailed(("enmType=%d\n", pMem Os2->Core.enmType));103 AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType)); 103 104 return VERR_INTERNAL_ERROR; 104 105 } … … 112 113 NOREF(fExecutable); 113 114 115 #if 0 114 116 /* create the object. */ 115 117 const ULONG cPages = cb >> PAGE_SHIFT; 116 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_PAGE, NULL, cb);117 if (!pMem Os2)118 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_PAGE, NULL, cb); 119 if (!pMemFreeBSD) 118 120 return VERR_NO_MEMORY; 119 121 120 122 /* do the allocation. */ 121 int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMem Os2->Core.pv, (PPVOID)-1, NULL);123 int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL); 122 124 if (!rc) 123 125 { 124 126 ULONG cPagesRet = cPages; 125 rc = KernLinToPageList(pMem Os2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);127 rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet); 126 128 if (!rc) 127 129 { 128 rtR0MemObjFixPageList(&pMem Os2->aPages[0], cPages, cPagesRet);129 *ppMem = &pMem Os2->Core;130 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 131 *ppMem = &pMemFreeBSD->Core; 130 132 return VINF_SUCCESS; 131 133 } 132 KernVMFree(pMemOs2->Core.pv); 133 } 134 rtR0MemObjDelete(&pMemOs2->Core); 135 return RTErrConvertFromOS2(rc); 134 KernVMFree(pMemFreeBSD->Core.pv); 135 } 136 rtR0MemObjDelete(&pMemFreeBSD->Core); 137 return RTErrConvertFromOS2(rc); 138 #endif 139 return VERR_NOT_IMPLEMENTED; 136 140 } 137 141 … … 141 145 NOREF(fExecutable); 142 146 143 /* create the object. */ 147 #if 0 148 /* create the object. */ 144 149 const ULONG cPages = cb >> PAGE_SHIFT; 145 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb);146 if (!pMem Os2)150 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOW, NULL, cb); 151 if (!pMemFreeBSD) 147 152 return VERR_NO_MEMORY; 148 153 149 154 /* do the allocation. */ 150 int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMem Os2->Core.pv, (PPVOID)-1, NULL);155 int rc = KernVMAlloc(cb, VMDHA_FIXED, &pMemFreeBSD->Core.pv, (PPVOID)-1, NULL); 151 156 if (!rc) 152 157 { 153 158 ULONG cPagesRet = cPages; 154 rc = KernLinToPageList(pMem Os2->Core.pv, cb, &pMemOs2->aPages[0], &cPagesRet);159 rc = KernLinToPageList(pMemFreeBSD->Core.pv, cb, &pMemFreeBSD->aPages[0], &cPagesRet); 155 160 if (!rc) 156 161 { 157 rtR0MemObjFixPageList(&pMem Os2->aPages[0], cPages, cPagesRet);158 *ppMem = &pMem Os2->Core;162 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 163 *ppMem = &pMemFreeBSD->Core; 159 164 return VINF_SUCCESS; 160 165 } 161 KernVMFree(pMemOs2->Core.pv); 162 } 163 rtR0MemObjDelete(&pMemOs2->Core); 164 return RTErrConvertFromOS2(rc); 166 KernVMFree(pMemFreeBSD->Core.pv); 167 } 168 rtR0MemObjDelete(&pMemFreeBSD->Core); 169 return RTErrConvertFromOS2(rc); 170 #endif 171 return VERR_NOT_IMPLEMENTED; 165 172 } 166 173 … … 170 177 NOREF(fExecutable); 171 178 172 /* create the object. */ 173 PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT, NULL, cb); 174 if (!pMemOs2) 179 #if 0 180 /* create the object. */ 181 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_CONT, NULL, cb); 182 if (!pMemFreeBSD) 175 183 return VERR_NO_MEMORY; 176 184 177 185 /* do the allocation. */ 178 186 ULONG ulPhys = ~0UL; 179 int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMem Os2->Core.pv, (PPVOID)&ulPhys, NULL);187 int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL); 180 188 if (!rc) 181 189 { 182 190 Assert(ulPhys != ~0UL); 183 pMemOs2->Core.u.Cont.Phys = ulPhys; 184 *ppMem = &pMemOs2->Core; 185 return VINF_SUCCESS; 186 } 187 rtR0MemObjDelete(&pMemOs2->Core); 188 return RTErrConvertFromOS2(rc); 191 pMemFreeBSD->Core.u.Cont.Phys = ulPhys; 192 *ppMem = &pMemFreeBSD->Core; 193 return VINF_SUCCESS; 194 } 195 rtR0MemObjDelete(&pMemFreeBSD->Core); 196 return RTErrConvertFromOS2(rc); 197 #endif 198 return VERR_NOT_IMPLEMENTED; 189 199 } 190 200 … … 193 203 { 194 204 AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%VHp\n", PhysHighest), VERR_NOT_IMPLEMENTED); 195 196 /* create the object. */ 197 PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb); 198 if (!pMemOs2) 205 206 #if 0 207 /* create the object. */ 208 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb); 209 if (!pMemFreeBSD) 199 210 return VERR_NO_MEMORY; 200 211 201 212 /* do the allocation. */ 202 213 ULONG ulPhys = ~0UL; 203 int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMem Os2->Core.pv, (PPVOID)&ulPhys, NULL);214 int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0), &pMemFreeBSD->Core.pv, (PPVOID)&ulPhys, NULL); 204 215 if (!rc) 205 216 { 206 217 Assert(ulPhys != ~0UL); 207 pMemOs2->Core.u.Phys.fAllocated = true; 208 pMemOs2->Core.u.Phys.PhysBase = ulPhys; 209 *ppMem = &pMemOs2->Core; 210 return VINF_SUCCESS; 211 } 212 rtR0MemObjDelete(&pMemOs2->Core); 213 return RTErrConvertFromOS2(rc); 218 pMemFreeBSD->Core.u.Phys.fAllocated = true; 219 pMemFreeBSD->Core.u.Phys.PhysBase = ulPhys; 220 *ppMem = &pMemFreeBSD->Core; 221 return VINF_SUCCESS; 222 } 223 rtR0MemObjDelete(&pMemFreeBSD->Core); 224 return RTErrConvertFromOS2(rc); 225 #endif 226 return VERR_NOT_IMPLEMENTED; 214 227 } 215 228 … … 217 230 int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb) 218 231 { 219 /* create the object. */ 220 PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb); 221 if (!pMemOs2) 232 #if 0 233 /* create the object. */ 234 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_PHYS, NULL, cb); 235 if (!pMemFreeBSD) 222 236 return VERR_NO_MEMORY; 223 237 224 238 /* there is no allocation here, right? it needs to be mapped somewhere first. */ 225 pMem Os2->Core.u.Phys.fAllocated = false;226 pMem Os2->Core.u.Phys.PhysBase = Phys;227 *ppMem = &pMem Os2->Core;239 pMemFreeBSD->Core.u.Phys.fAllocated = false; 240 pMemFreeBSD->Core.u.Phys.PhysBase = Phys; 241 *ppMem = &pMemFreeBSD->Core; 228 242 return VINF_SUCCESS; 243 #endif 244 return VERR_NOT_IMPLEMENTED; 229 245 } 230 246 … … 232 248 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process) 233 249 { 250 #if 0 234 251 AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); 235 252 236 253 /* create the object. */ 237 254 const ULONG cPages = cb >> PAGE_SHIFT; 238 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);239 if (!pMem Os2)255 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb); 256 if (!pMemFreeBSD) 240 257 return VERR_NO_MEMORY; 241 258 242 259 /* lock it. */ 243 260 ULONG cPagesRet = cPages; 244 int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet); 245 if (!rc) 246 { 247 rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet); 248 Assert(cb == pMemOs2->Core.cb); 249 Assert(pv == pMemOs2->Core.pv); 250 pMemOs2->Core.u.Lock.R0Process = R0Process; 251 *ppMem = &pMemOs2->Core; 252 return VINF_SUCCESS; 253 } 254 rtR0MemObjDelete(&pMemOs2->Core); 255 return RTErrConvertFromOS2(rc); 261 int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet); 262 if (!rc) 263 { 264 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 265 Assert(cb == pMemFreeBSD->Core.cb); 266 Assert(pv == pMemFreeBSD->Core.pv); 267 pMemFreeBSD->Core.u.Lock.R0Process = R0Process; 268 *ppMem = &pMemFreeBSD->Core; 269 return VINF_SUCCESS; 270 } 271 rtR0MemObjDelete(&pMemFreeBSD->Core); 272 return RTErrConvertFromOS2(rc); 273 #endif 274 return VERR_NOT_IMPLEMENTED; 256 275 } 257 276 … … 259 278 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb) 260 279 { 280 #if 0 261 281 /* create the object. */ 262 282 const ULONG cPages = cb >> PAGE_SHIFT; 263 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);264 if (!pMem Os2)283 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, aPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb); 284 if (!pMemFreeBSD) 265 285 return VERR_NO_MEMORY; 266 286 267 287 /* lock it. */ 268 288 ULONG cPagesRet = cPages; 269 int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemOs2->Lock, &pMemOs2->aPages[0], &cPagesRet); 270 if (!rc) 271 { 272 rtR0MemObjFixPageList(&pMemOs2->aPages[0], cPages, cPagesRet); 273 pMemOs2->Core.u.Lock.R0Process = NIL_RTR0PROCESS; 274 *ppMem = &pMemOs2->Core; 275 return VINF_SUCCESS; 276 } 277 rtR0MemObjDelete(&pMemOs2->Core); 278 return RTErrConvertFromOS2(rc); 289 int rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE, pv, cb, &pMemFreeBSD->Lock, &pMemFreeBSD->aPages[0], &cPagesRet); 290 if (!rc) 291 { 292 rtR0MemObjFixPageList(&pMemFreeBSD->aPages[0], cPages, cPagesRet); 293 pMemFreeBSD->Core.u.Lock.R0Process = NIL_RTR0PROCESS; 294 *ppMem = &pMemFreeBSD->Core; 295 return VINF_SUCCESS; 296 } 297 rtR0MemObjDelete(&pMemFreeBSD->Core); 298 return RTErrConvertFromOS2(rc); 299 #endif 300 return VERR_NOT_IMPLEMENTED; 279 301 } 280 302 … … 296 318 AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); 297 319 320 #if 0 298 321 /** @todo finish the implementation. */ 299 322 300 323 int rc; 301 324 void *pvR0 = NULL; 302 PRTR0MEMOBJ OS2 pMemToMapOs2 = (PRTR0MEMOBJOS2)pMemToMap;325 PRTR0MEMOBJFREEBSD pMemToMapOs2 = (PRTR0MEMOBJFREEBSD)pMemToMap; 303 326 switch (pMemToMapOs2->Core.enmType) 304 327 { … … 349 372 * (reference counting). 350 373 */ 351 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR0, pMemToMapOs2->Core.cb);352 if (pMem Os2)353 { 354 pMem Os2->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;355 *ppMem = &pMem Os2->Core;374 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR0, pMemToMapOs2->Core.cb); 375 if (pMemFreeBSD) 376 { 377 pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; 378 *ppMem = &pMemFreeBSD->Core; 356 379 return VINF_SUCCESS; 357 380 } 358 381 return VERR_NO_MEMORY; 382 #endif 383 return VERR_NOT_IMPLEMENTED; 359 384 } 360 385 … … 365 390 AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); 366 391 392 #if 0 367 393 int rc; 368 394 void *pvR0; 369 395 void *pvR3 = NULL; 370 PRTR0MEMOBJ OS2 pMemToMapOs2 = (PRTR0MEMOBJOS2)pMemToMap;396 PRTR0MEMOBJFREEBSD pMemToMapOs2 = (PRTR0MEMOBJFREEBSD)pMemToMap; 371 397 switch (pMemToMapOs2->Core.enmType) 372 398 { … … 431 457 * Create a mapping object for it. 432 458 */ 433 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR3, pMemToMapOs2->Core.cb);434 if (pMem Os2)435 { 436 Assert(pMem Os2->Core.pv == pvR3);437 pMem Os2->Core.u.Mapping.R0Process = R0Process;438 *ppMem = &pMem Os2->Core;459 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJOS2, Lock), RTR0MEMOBJTYPE_MAPPING, pvR3, pMemToMapOs2->Core.cb); 460 if (pMemFreeBSD) 461 { 462 Assert(pMemFreeBSD->Core.pv == pvR3); 463 pMemFreeBSD->Core.u.Mapping.R0Process = R0Process; 464 *ppMem = &pMemFreeBSD->Core; 439 465 return VINF_SUCCESS; 440 466 } 441 467 KernVMFree(pvR3); 442 468 return VERR_NO_MEMORY; 469 #endif 470 return VERR_NOT_IMPLEMENTED; 443 471 } 444 472 … … 446 474 RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, unsigned iPage) 447 475 { 448 PRTR0MEMOBJ OS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;449 450 switch (pMem Os2->Core.enmType)476 PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem; 477 478 switch (pMemFreeBSD->Core.enmType) 451 479 { 452 480 case RTR0MEMOBJTYPE_PAGE: 453 481 case RTR0MEMOBJTYPE_LOW: 454 482 case RTR0MEMOBJTYPE_LOCK: 455 return pMemOs2->aPages[iPage].Addr; 483 // return pMemFreeBSD->aPages[iPage].Addr; 484 return NIL_RTHCPHYS; 456 485 457 486 case RTR0MEMOBJTYPE_CONT: 458 return pMem Os2->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);487 return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); 459 488 460 489 case RTR0MEMOBJTYPE_PHYS: 461 return pMem Os2->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT);490 return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT); 462 491 463 492 case RTR0MEMOBJTYPE_RES_VIRT: … … 467 496 } 468 497 } 469 470 471 /**472 * Expands the page list so we can index pages directly.473 *474 * @param paPages The page list array to fix.475 * @param cPages The number of pages that's supposed to go into the list.476 * @param cPagesRet The actual number of pages in the list.477 */478 static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet)479 {480 Assert(cPages >= cPagesRet);481 if (cPages != cPagesRet)482 {483 ULONG iIn = cPagesRet;484 ULONG iOut = cPages;485 do486 {487 iIn--;488 iOut--;489 Assert(iIn <= iOut);490 491 KernPageList_t Page = paPages[iIn];492 Assert(!(Page.Addr & PAGE_OFFSET_MASK));493 Assert(Page.Size == RT_ALIGN_Z(Page.Size, PAGE_SIZE));494 495 if (Page.Size > PAGE_SIZE)496 {497 do498 {499 Page.Size -= PAGE_SIZE;500 paPages[iOut].Addr = Page.Addr + Page.Size;501 paPages[iOut].Size = PAGE_SIZE;502 iOut--;503 } while (Page.Size > PAGE_SIZE);504 }505 506 paPages[iOut].Addr = Page.Addr;507 paPages[iOut].Size = PAGE_SIZE;508 } while ( iIn != iOut509 && iIn > 0);510 }511 }512
Note:
See TracChangeset
for help on using the changeset viewer.