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/freebsd/memobj-r0drv-freebsd.c

    r100357 r104848  
    7777#include <iprt/param.h>
    7878#include <iprt/process.h>
     79#include <iprt/string.h>
    7980#include "internal/memobj.h"
    8081
     
    906907}
    907908
     909
     910DECLHIDDEN(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
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