VirtualBox

Ignore:
Timestamp:
Jun 5, 2024 9:38:20 AM (8 months ago)
Author:
vboxsync
Message:

VMM/PGM,SUPDrv,IPRT: Added a RTR0MemObjZeroInitialize function to IPRT/SUPDrv for helping zero initializing MMIO2 backing memory. bugref:10687

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c

    r104096 r104848  
    21812181}
    21822182
     2183
     2184DECLHIDDEN(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
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette