VirtualBox

Ignore:
Timestamp:
Feb 2, 2022 10:57:02 PM (3 years ago)
Author:
vboxsync
Message:

VMM: Changed PAGE_SIZE -> GUEST_PAGE_SIZE / HOST_PAGE_SIZE, PAGE_SHIFT -> GUEST_PAGE_SHIFT / HOST_PAGE_SHIFT, and PAGE_OFFSET_MASK -> GUEST_PAGE_OFFSET_MASK / HOST_PAGE_OFFSET_MASK. Also removed most usage of ASMMemIsZeroPage and ASMMemZeroPage since the host and guest page size doesn't need to be the same any more. Some work left to do in the page pool code. bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp

    r93115 r93554  
    890890                     */
    891891                    const uint32_t  cbVM      = RT_UOFFSETOF_DYN(GVM, aCpus[cCpus]);
    892                     const uint32_t  cPages    = RT_ALIGN_32(cbVM, PAGE_SIZE) >> PAGE_SHIFT;
     892                    const uint32_t  cPages    = RT_ALIGN_32(cbVM, HOST_PAGE_SIZE) >> HOST_PAGE_SHIFT;
    893893                    RTR0MEMOBJ      hVMMemObj = NIL_RTR0MEMOBJ;
    894                     rc = RTR0MemObjAllocPage(&hVMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */);
     894                    rc = RTR0MemObjAllocPage(&hVMMemObj, cPages << HOST_PAGE_SHIFT, false /* fExecutable */);
    895895                    if (RT_SUCCESS(rc))
    896896                    {
     
    901901                         * Initialise the structure.
    902902                         */
    903                         RT_BZERO(pGVM, cPages << PAGE_SHIFT);
     903                        RT_BZERO(pGVM, cPages << HOST_PAGE_SHIFT);
    904904                        gvmmR0InitPerVMData(pGVM, iHandle, cCpus, pSession);
    905905                        pGVM->gvmm.s.VMMemObj  = hVMMemObj;
     
    931931                                 * Map the page array, VM and VMCPU structures into ring-3.
    932932                                 */
    933                                 AssertCompileSizeAlignment(VM, PAGE_SIZE);
     933                                AssertCompileSizeAlignment(VM, HOST_PAGE_SIZE);
    934934                                rc = RTR0MemObjMapUserEx(&pGVM->gvmm.s.VMMapObj, pGVM->gvmm.s.VMMemObj, (RTR3PTR)-1, 0,
    935935                                                         RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS,
     
    937937                                for (VMCPUID i = 0; i < cCpus && RT_SUCCESS(rc); i++)
    938938                                {
    939                                     AssertCompileSizeAlignment(VMCPU, PAGE_SIZE);
     939                                    AssertCompileSizeAlignment(VMCPU, HOST_PAGE_SIZE);
    940940                                    rc = RTR0MemObjMapUserEx(&pGVM->aCpus[i].gvmm.s.VMCpuMapObj, pGVM->gvmm.s.VMMemObj,
    941941                                                             (RTR3PTR)-1, 0, RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS,
     
    12541254     */
    12551255    AssertPtrReturn(pGVM, VERR_INVALID_POINTER);
    1256     AssertReturn(!((uintptr_t)pGVM & PAGE_OFFSET_MASK), VERR_INVALID_POINTER);
     1256    AssertReturn(!((uintptr_t)pGVM & HOST_PAGE_OFFSET_MASK), VERR_INVALID_POINTER);
    12571257    AssertMsgReturn(pGVM->enmVMState >= VMSTATE_CREATING && pGVM->enmVMState <= VMSTATE_TERMINATED, ("%d\n", pGVM->enmVMState),
    12581258                    VERR_WRONG_ORDER);
     
    18611861    int rc;
    18621862    if (RT_LIKELY(   RT_VALID_PTR(pGVM)
    1863                   && ((uintptr_t)pGVM & PAGE_OFFSET_MASK) == 0 ))
     1863                  && ((uintptr_t)pGVM & HOST_PAGE_OFFSET_MASK) == 0 ))
    18641864    {
    18651865        /*
     
    19511951     */
    19521952    AssertPtrReturn(pGVM, VERR_INVALID_POINTER);
    1953     AssertReturn(((uintptr_t)pGVM & PAGE_OFFSET_MASK) == 0, VERR_INVALID_POINTER);
     1953    AssertReturn(((uintptr_t)pGVM & HOST_PAGE_OFFSET_MASK) == 0, VERR_INVALID_POINTER);
    19541954
    19551955    /*
     
    22692269    uintptr_t const off = (uintptr_t)pv - (uintptr_t)pGVM;
    22702270    Assert(off < RT_UOFFSETOF_DYN(GVM, aCpus[pGVM->cCpus]));
    2271     return RTR0MemObjGetPagePhysAddr(pGVM->gvmm.s.VMMemObj, off >> PAGE_SHIFT) | ((uintptr_t)pv & PAGE_OFFSET_MASK);
     2271    return RTR0MemObjGetPagePhysAddr(pGVM->gvmm.s.VMMemObj, off >> HOST_PAGE_SHIFT) | ((uintptr_t)pv & HOST_PAGE_OFFSET_MASK);
    22722272}
    22732273
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