VirtualBox

Changeset 67993 in vbox


Ignore:
Timestamp:
Jul 17, 2017 12:50:13 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
117002
Message:

PGMR0Phys*Handy*: Added pGVM parameter and changed the PVMCPU to idCpu.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/gmm.h

    r62476 r67993  
    403403                                        GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority);
    404404GMMR0DECL(int)  GMMR0UpdateReservation(PVM pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages);
    405 GMMR0DECL(int)  GMMR0AllocateHandyPages(PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages);
     405GMMR0DECL(int)  GMMR0AllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate,
     406                                        uint32_t cPagesToAlloc, PGMMPAGEDESC paPages);
    406407GMMR0DECL(int)  GMMR0AllocatePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount);
    407408GMMR0DECL(int)  GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pIdPage, RTHCPHYS *pHCPhys);
  • trunk/include/VBox/vmm/pgm.h

    r66023 r67993  
    692692 * @{
    693693 */
    694 VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM, PVMCPU pVCpu);
    695 VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PVM pVM, PVMCPU pVCpu);
     694VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu);
     695VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu);
    696696VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PVM pVM, PVMCPU pVCpu);
    697697VMMR0_INT_DECL(int) PGMR0PhysSetupIommu(PVM pVM);
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r66439 r67993  
    27292729 * @param   paPages             The array of page descriptors.
    27302730 *                              See GMMPAGEDESC for details on what is expected on input.
    2731  * @thread  EMT.
    2732  */
    2733 GMMR0DECL(int) GMMR0AllocateHandyPages(PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages)
    2734 {
    2735     LogFlow(("GMMR0AllocateHandyPages: pVM=%p cPagesToUpdate=%#x cPagesToAlloc=%#x paPages=%p\n",
    2736              pVM, cPagesToUpdate, cPagesToAlloc, paPages));
     2731 * @thread  EMT(idCpu)
     2732 */
     2733GMMR0DECL(int) GMMR0AllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate,
     2734                                       uint32_t cPagesToAlloc, PGMMPAGEDESC paPages)
     2735{
     2736    LogFlow(("GMMR0AllocateHandyPages: pGVM=%p pVM=%p cPagesToUpdate=%#x cPagesToAlloc=%#x paPages=%p\n",
     2737             pGVM, pVM, cPagesToUpdate, cPagesToAlloc, paPages));
    27372738
    27382739    /*
     
    27422743    PGMM pGMM;
    27432744    GMM_GET_VALID_INSTANCE(pGMM, VERR_GMM_INSTANCE);
    2744     PGVM pGVM;
    2745     int rc = GVMMR0ByVMAndEMT(pVM, idCpu, &pGVM);
     2745    int rc = GVMMR0ValidateGVMandVMandEMT(pGVM, pVM, idCpu);
    27462746    if (RT_FAILURE(rc))
    27472747        return rc;
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r63560 r67993  
    6161 * @retval  VINF_EM_NO_MEMORY if we're out of memory. The FF is set in this case.
    6262 *
     63 * @param   pGVM        The global (ring-0) VM structure.
    6364 * @param   pVM         The cross context VM structure.
    64  * @param   pVCpu       The cross context virtual CPU structure.
     65 * @param   idCpu       The ID of the calling EMT.
     66 *
     67 * @thread  EMT(idCpu)
    6568 *
    6669 * @remarks Must be called from within the PGM critical section. The caller
    6770 *          must clear the new pages.
    6871 */
    69 VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM, PVMCPU pVCpu)
    70 {
     72VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     73{
     74    /*
     75     * Validate inputs.
     76     */
     77    AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_CPU_ID); /* caller already checked this, but just to be sure. */
     78    AssertReturn(pGVM->aCpus[idCpu].hEMT == RTThreadNativeSelf(), VERR_NOT_OWNER);
     79    PVMCPU pVCpu = &pVM->aCpus[idCpu];
     80
    7181    PGM_LOCK_ASSERT_OWNER_EX(pVM, pVCpu);
    7282
     
    8595    if (!cPages)
    8696        return VINF_SUCCESS;
    87     int rc = GMMR0AllocateHandyPages(pVM, pVCpu->idCpu, cPages, cPages, &pVM->pgm.s.aHandyPages[iFirst]);
     97    int rc = GMMR0AllocateHandyPages(pGVM, pVM, idCpu, cPages, cPages, &pVM->pgm.s.aHandyPages[iFirst]);
    8898    if (RT_SUCCESS(rc))
    8999    {
     
    127137                if (cPages + iFirst < PGM_HANDY_PAGES_MIN)
    128138                    cPages = PGM_HANDY_PAGES_MIN - iFirst;
    129                 rc = GMMR0AllocateHandyPages(pVM, pVCpu->idCpu, 0, cPages, &pVM->pgm.s.aHandyPages[iFirst]);
     139                rc = GMMR0AllocateHandyPages(pGVM, pVM, idCpu, 0, cPages, &pVM->pgm.s.aHandyPages[iFirst]);
    130140            } while (   (   rc == VERR_GMM_HIT_GLOBAL_LIMIT
    131141                         || rc == VERR_GMM_HIT_VM_ACCOUNT_LIMIT)
     
    177187 * @retval  VINF_SUCCESS on success. FF cleared.
    178188 *
     189 * @param   pGVM        The global (ring-0) VM structure.
    179190 * @param   pVM         The cross context VM structure.
    180  * @param   pVCpu       The cross context virtual CPU structure.
     191 * @param   idCpu       The ID of the calling EMT.
     192 *
     193 * @thread  EMT(idCpu)
    181194 *
    182195 * @remarks Must be called from within the PGM critical section.
    183196 */
    184 VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PVM pVM, PVMCPU pVCpu)
    185 {
     197VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     198{
     199    /*
     200     * Validate inputs.
     201     */
     202    AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_CPU_ID); /* caller already checked this, but just to be sure. */
     203    AssertReturn(pGVM->aCpus[idCpu].hEMT == RTThreadNativeSelf(), VERR_NOT_OWNER);
     204    PVMCPU pVCpu = &pVM->aCpus[idCpu];
     205
    186206    PGM_LOCK_ASSERT_OWNER_EX(pVM, pVCpu);
    187207
     
    194214    if (!cPages)
    195215        return VINF_SUCCESS;
    196     int rc = GMMR0AllocateHandyPages(pVM, pVCpu->idCpu, cPages, 0, &pVM->pgm.s.aHandyPages[iFirst]);
     216    int rc = GMMR0AllocateHandyPages(pGVM, pVM, idCpu, cPages, 0, &pVM->pgm.s.aHandyPages[iFirst]);
    197217
    198218    LogFlow(("PGMR0PhysFlushHandyPages: cPages=%d rc=%Rrc\n", cPages, rc));
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r67991 r67993  
    16341634            if (idCpu == NIL_VMCPUID)
    16351635                return VERR_INVALID_CPU_ID;
    1636             rc = PGMR0PhysAllocateHandyPages(pVM, &pVM->aCpus[idCpu]);
     1636            rc = PGMR0PhysAllocateHandyPages(pGVM, pVM, idCpu);
    16371637            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    16381638            break;
     
    16411641            if (idCpu == NIL_VMCPUID)
    16421642                return VERR_INVALID_CPU_ID;
    1643             rc = PGMR0PhysFlushHandyPages(pVM, &pVM->aCpus[idCpu]);
     1643            rc = PGMR0PhysFlushHandyPages(pGVM, pVM, idCpu);
    16441644            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    16451645            break;
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