VirtualBox

Ignore:
Timestamp:
Aug 15, 2019 7:29:37 AM (5 years ago)
Author:
vboxsync
Message:

VMM,++: Refactoring code to use VMMC & VMMCPUCC. bugref:9217

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/MMHyper.cpp

    r80191 r80281  
    2828#include "MMInternal.h"
    2929#include <VBox/vmm/vm.h>
     30#include <VBox/vmm/gvm.h>
    3031#include <VBox/err.h>
    3132#include <VBox/param.h>
     
    152153        /*
    153154         * Map the VM structure into the hypervisor space.
     155         * Note! Keeping the mappings here for now in case someone is using
     156         *       MMHyperR3ToR0 or similar.
    154157         */
     158        AssertCompileSizeAlignment(VM, PAGE_SIZE);
     159        AssertCompileSizeAlignment(VMCPU, PAGE_SIZE);
    155160#ifdef VBOX_BUGREF_9217
    156         AssertRelease(pVM->cbSelf >= sizeof(VMCPU) * pVM->cCpus + sizeof(*pVM));
     161        AssertCompileSizeAlignment(GVM, PAGE_SIZE);
     162        AssertCompileSizeAlignment(GVMCPU, PAGE_SIZE);
     163        AssertRelease(pVM->cbSelf == sizeof(VM));
     164        AssertRelease(pVM->cbVCpu == sizeof(VMCPU));
     165        RTGCPTR GCPtr;
     166        rc = MMR3HyperMapPages(pVM, pVM, pVM->pVMR0ForCall, sizeof(VM) >> PAGE_SHIFT, pVM->paVMPagesR3, "VM", &GCPtr);
     167        uint32_t offPages = RT_UOFFSETOF(GVM, aCpus) >> PAGE_SHIFT;
     168        for (uint32_t idCpu = 0; idCpu < pVM->cCpus && RT_SUCCESS(rc); idCpu++, offPages += sizeof(GVMCPU) >> PAGE_SHIFT)
     169        {
     170            PVMCPU pVCpu = pVM->apCpusR3[idCpu];
     171            RTGCPTR GCPtrIgn;
     172            rc = MMR3HyperMapPages(pVM, pVCpu, pVM->pVMR0ForCall + offPages * PAGE_SIZE,
     173                                   sizeof(VMCPU) >> PAGE_SHIFT, &pVM->paVMPagesR3[offPages], "VMCPU", &GCPtrIgn);
     174        }
    157175#else
    158176        AssertRelease(pVM->cbSelf >= sizeof(VMCPU));
     177        RTGCPTR GCPtr;
     178        rc = MMR3HyperMapPages(pVM, pVM, pVM->pVMR0,
     179                               RT_ALIGN_Z(pVM->cbSelf, PAGE_SIZE) >> PAGE_SHIFT, pVM->paVMPagesR3, "VM",
     180                               &GCPtr);
    159181#endif
    160         RTGCPTR GCPtr;
    161         rc = MMR3HyperMapPages(pVM, pVM, pVM->pVMR0, RT_ALIGN_Z(pVM->cbSelf, PAGE_SIZE) >> PAGE_SHIFT, pVM->paVMPagesR3, "VM",
    162                                &GCPtr);
    163182        if (RT_SUCCESS(rc))
    164183        {
     
    876895        //pHeap->pbHeapRC           = 0; // set by mmR3HyperHeapMap()
    877896        pHeap->pVMR3                = pVM;
     897#ifdef VBOX_BUGREF_9217
     898        pHeap->pVMR0                = pVM->pVMR0ForCall;
     899#else
    878900        pHeap->pVMR0                = pVM->pVMR0;
     901#endif
    879902        pHeap->pVMRC                = pVM->pVMRC;
    880903        pHeap->cbHeap               = cbAligned - MMYPERHEAP_HDR_SIZE;
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