- Timestamp:
- Jun 5, 2024 9:38:20 AM (8 months ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp
r103684 r104848 474 474 SUPEXP_STK_OKAY( 1, RTR0MemObjSize), 475 475 SUPEXP_STK_OKAY( 1, RTR0MemObjWasZeroInitialized), 476 SUPEXP_STK_OKAY( 2, RTR0MemObjZeroInitialize), 476 477 SUPEXP_STK_BACK( 3, RTR0MemUserCopyFrom), 477 478 SUPEXP_STK_BACK( 3, RTR0MemUserCopyTo), -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r104327 r104848 233 233 * - nothing 234 234 */ 235 #define SUPDRV_IOC_VERSION 0x0034000 0235 #define SUPDRV_IOC_VERSION 0x00340001 236 236 237 237 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r104328 r104848 298 298 strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC); 299 299 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 300 const uint32_t uMinVersion = /*(SUPDRV_IOC_VERSION & 0xffff0000) == 0x00340000301 ? 0x0034000 0302 : */SUPDRV_IOC_VERSION & 0xffff0000;300 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00340000 301 ? 0x00340001 302 : SUPDRV_IOC_VERSION & 0xffff0000; 303 303 CookieReq.u.In.u32MinVersion = uMinVersion; 304 304 rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE); -
trunk/src/VBox/Runtime/include/internal/memobj.h
r100357 r104848 538 538 DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage); 539 539 540 /** 541 * Zero initialize an object without a ring-0 mapping. 542 * 543 * @returns IPRT status code. 544 * @param pMem The ring-0 memory object handle. 545 */ 546 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem); 547 540 548 DECLHIDDEN(PRTR0MEMOBJINTERNAL) rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb, const char *pszTag); 541 549 DECLHIDDEN(void) rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem); -
trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
r100357 r104848 1580 1580 } 1581 1581 1582 1583 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 1584 { 1585 RT_NOREF(pMem); 1586 return VERR_NOT_IMPLEMENTED; 1587 } 1588 -
trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
r100357 r104848 77 77 #include <iprt/param.h> 78 78 #include <iprt/process.h> 79 #include <iprt/string.h> 79 80 #include "internal/memobj.h" 80 81 … … 906 907 } 907 908 909 910 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 911 { 912 PRTR0MEMOBJFREEBSD const pMemFreeBsd = (PRTR0MEMOBJFREEBSD)pMem; 913 size_t const cPages = pMemSolaris->Core.cb >> PAGE_SHIFT; 914 size_t iPage; 915 for (iPage = 0; iPage < cPages; iPage++) 916 { 917 void *pvPage; 918 919 /* Get the physical address of the page. */ 920 RTHCPHYS const HCPhys = rtR0MemObjNativeGetPagePhysAddr(&pMemFreeBsd->Core, iPage); 921 AssertReturn(HCPhys != NIL_RTHCPHYS, VERR_INTERNAL_ERROR_3); 922 Assert(!(HCPhys & PAGE_OFFSET_MASK)); 923 924 /* Map it. */ 925 pvPage = (void *)(uintptr_t)pmap_map(NULL, HCPhys, (HCPhys | PAGE_OFFSET_MASK) + 1, VM_PROT_WRITE | VM_PROT_READ); 926 AssertPtrReturn(pvPage, VERR_INTERNAL_ERROR_3); 927 928 /* Zero it. */ 929 RT_BZERO(pvPage, PAGE_SIZE); 930 } 931 return VINF_SUCCESS; 932 } 933 -
trunk/src/VBox/Runtime/r0drv/haiku/memobj-r0drv-haiku.c
r100357 r104848 685 685 } 686 686 687 688 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 689 { 690 RT_NOREF(pMem); 691 return VERR_NOT_IMPLEMENTED; 692 } 693 -
trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
r104096 r104848 2181 2181 } 2182 2182 2183 2184 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 2185 { 2186 PRTR0MEMOBJLNX const pMemLnx = (PRTR0MEMOBJLNX)pMem; 2187 size_t const cPages = pMemLnx->Core.cb >> PAGE_SHIFT; 2188 size_t iPage; 2189 /** @todo optimize this. */ 2190 for (iPage = 0; iPage < cPages; iPage++) 2191 { 2192 void *pvPage; 2193 2194 /* Get the physical address of the page. */ 2195 RTHCPHYS const HCPhys = rtR0MemObjNativeGetPagePhysAddr(&pMemLnx->Core, iPage); 2196 AssertReturn(HCPhys != NIL_RTHCPHYS, VERR_INTERNAL_ERROR_3); 2197 Assert(!(HCPhys & PAGE_OFFSET_MASK)); 2198 2199 /* Would've like to use valid_phys_addr_range for this test, but it isn't exported. */ 2200 AssertReturn((HCPhys | PAGE_OFFSET_MASK) < __pa(high_memory), VERR_INTERNAL_ERROR_3); 2201 2202 /* Map it. */ 2203 pvPage = phys_to_virt(HCPhys); 2204 AssertPtrReturn(pvPage, VERR_INTERNAL_ERROR_3); 2205 2206 /* Zero it. */ 2207 RT_BZERO(pvPage, PAGE_SIZE); 2208 } 2209 return VINF_SUCCESS; 2210 } 2211 -
trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
r100357 r104848 52 52 #include <iprt/param.h> 53 53 #include <iprt/process.h> 54 #include <iprt/string.h> 54 55 #include <iprt/thread.h> 55 56 … … 296 297 297 298 299 RTR0DECL(int) RTR0MemObjZeroInitialize(RTR0MEMOBJ hMemObj, bool fForce) 300 { 301 PRTR0MEMOBJINTERNAL pMem; 302 303 /* Validate the object handle. */ 304 AssertReturn(hMemObj != NIL_RTR0MEMOBJ, VERR_INVALID_HANDLE); 305 AssertPtrReturn(hMemObj, VERR_INVALID_HANDLE); 306 pMem = (PRTR0MEMOBJINTERNAL)hMemObj; 307 AssertMsgReturn(pMem->u32Magic == RTR0MEMOBJ_MAGIC, ("%p: %#x\n", pMem, pMem->u32Magic), VERR_INVALID_HANDLE); 308 AssertMsgReturn(pMem->enmType > RTR0MEMOBJTYPE_INVALID && pMem->enmType < RTR0MEMOBJTYPE_END, ("%p: %d\n", pMem, pMem->enmType), VERR_INVALID_HANDLE); 309 AssertReturn( (pMem->enmType != RTR0MEMOBJTYPE_MAPPING || pMem->u.Mapping.R0Process == NIL_RTR0PROCESS) 310 && (pMem->enmType != RTR0MEMOBJTYPE_LOCK || pMem->u.Lock.R0Process == NIL_RTR0PROCESS) 311 && pMem->enmType != RTR0MEMOBJTYPE_RES_VIRT 312 , VERR_WRONG_TYPE); 313 Assert( (pMem->fFlags & (RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC | RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC)) 314 != (RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC | RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC)); 315 316 /* 317 * Do we need to do anything? 318 */ 319 if ( fForce 320 || (pMem->fFlags & (RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC | RTR0MEMOBJ_FLAGS_UNINITIALIZED_AT_ALLOC)) 321 != RTR0MEMOBJ_FLAGS_ZERO_AT_ALLOC) 322 { 323 /* This is easy if there is a ring-0 mapping: */ 324 if (pMem->pv) 325 RT_BZERO(pMem->pv, pMem->cb); 326 else 327 return rtR0MemObjNativeZeroInitWithoutMapping(pMem); 328 } 329 return VINF_SUCCESS; 330 } 331 RT_EXPORT_SYMBOL(RTR0MemObjWasZeroInitialized); 332 333 298 334 RTR0DECL(int) RTR0MemObjFree(RTR0MEMOBJ MemObj, bool fFreeMappings) 299 335 { -
trunk/src/VBox/Runtime/r0drv/netbsd/memobj-r0drv-netbsd.c
r100357 r104848 586 586 } 587 587 588 589 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 590 { 591 RT_NOREF(pMem); 592 return VERR_NOT_IMPLEMENTED; 593 } 594 -
trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
r104841 r104848 1301 1301 } 1302 1302 1303 1304 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 1305 { 1306 RT_NOREF(pMem); 1307 return VERR_NOT_IMPLEMENTED; 1308 } 1309 -
trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
r100357 r104848 635 635 } 636 636 637 638 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 639 { 640 RT_NOREF(pMem); 641 return VERR_NOT_IMPLEMENTED; 642 } 643 -
trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
r100359 r104848 50 50 #include <iprt/param.h> 51 51 #include <iprt/process.h> 52 #include <iprt/string.h> 52 53 #include "internal/memobj.h" 53 54 #include "memobj-r0drv-solaris.h" … … 1213 1214 } 1214 1215 1216 1217 DECLHIDDEN(int) rtR0MemObjNativeZeroInitWithoutMapping(PRTR0MEMOBJINTERNAL pMem) 1218 { 1219 PRTR0MEMOBJSOL const pMemSolaris = (PRTR0MEMOBJSOL)pMem; 1220 size_t const cPages = pMemSolaris->Core.cb >> PAGE_SHIFT; 1221 size_t iPage; 1222 for (iPage = 0; iPage < cPages; iPage++) 1223 { 1224 void *pvPage; 1225 1226 /* Get the physical address of the page. */ 1227 RTHCPHYS const HCPhys = rtR0MemObjNativeGetPagePhysAddr(&pMemSolaris->Core, iPage); 1228 AssertReturn(HCPhys != NIL_RTHCPHYS, VERR_INTERNAL_ERROR_3); 1229 Assert(!(HCPhys & PAGE_OFFSET_MASK)); 1230 1231 /* Map it. */ 1232 HCPhys >>= PAGE_SHIFT; 1233 AssertReturn(HCPhys <= physmax, VERR_INTERNAL_ERROR_3); 1234 pvPage = hat_kpm_pfn2va(HCPhys); 1235 AssertPtrReturn(pvPage, VERR_INTERNAL_ERROR_3); 1236 1237 /* Zero it. */ 1238 RT_BZERO(pvPage, PAGE_SIZE); 1239 } 1240 return VINF_SUCCESS; 1241 } 1242 -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r104840 r104848 1194 1194 AssertPtr(pbMmio2BackingR0); 1195 1195 # endif 1196 if (!RTR0MemObjWasZeroInitialized(hMemObj)) 1197 { 1198 void *pv = RTR0MemObjAddress(hMemObj); 1199 AssertReturnStmt(pv, RTR0MemObjFree(hMemObj, true /*fFreeMappings*/), VERR_INTERNAL_ERROR_4); 1200 RT_BZERO(pv, cbMmio2Aligned); 1201 } 1196 rc = RTR0MemObjZeroInitialize(hMemObj, false /*fForce*/); 1197 AssertRCReturnStmt(rc, RTR0MemObjFree(hMemObj, true /*fFreeMappings*/), rc); 1202 1198 #else 1203 1199 RT_BZERO(pbMmio2BackingR3, cbMmio2Aligned);
Note:
See TracChangeset
for help on using the changeset viewer.