VirtualBox

Changeset 51344 in vbox


Ignore:
Timestamp:
May 22, 2014 11:04:58 AM (11 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Hyper heap fixes.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
2 edited

Legend:

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

    r51334 r51344  
    567567static PCPUMCPUIDLEAF cpumR3CpuIdEnsureSpace(PVM pVM, PCPUMCPUIDLEAF *ppaLeaves, uint32_t cLeaves)
    568568{
    569     uint32_t cAllocated = RT_ALIGN(cLeaves, 16);
     569    uint32_t cAllocated;
     570    if (!pVM)
     571        cAllocated = RT_ALIGN(cLeaves, 16);
     572    else
     573    {
     574        /*
     575         * We're using the hyper heap now, but when the arrays were copied over to it from
     576         * the host-context heap, we only copy the exact size and not the ensured size.
     577         * See @bugref{7270}.
     578         */
     579        cAllocated = cLeaves;
     580    }
     581
    570582    if (cLeaves + 1 > cAllocated)
    571583    {
     
    585597                pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = NIL_RTR0PTR;
    586598                pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = NIL_RTRCPTR;
     599                LogRel(("CPUM: cpumR3CpuIdEnsureSpace: MMR3HyperRealloc failed. rc=%Rrc\n", rc));
    587600                return NULL;
    588601            }
    589 
    590             /* Update the R0 and RC pointers. */
    591             pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = MMHyperR3ToR0(pVM, *ppaLeaves);
    592             pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, *ppaLeaves);
     602            *ppaLeaves = (PCPUMCPUIDLEAF)pvNew;
    593603        }
    594604        else
     
    602612                return NULL;
    603613            }
    604         }
    605         *ppaLeaves   = (PCPUMCPUIDLEAF)pvNew;
    606     }
     614            *ppaLeaves = (PCPUMCPUIDLEAF)pvNew;
     615        }
     616    }
     617
     618#ifndef IN_VBOX_CPU_REPORT
     619    /* Update the R0 and RC pointers. */
     620    if (pVM)
     621    {
     622        Assert(ppaLeaves == &pVM->cpum.s.GuestInfo.paCpuIdLeavesR3);
     623        pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = MMHyperR3ToR0(pVM, *ppaLeaves);
     624        pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, *ppaLeaves);
     625    }
     626#endif
     627
    607628    return *ppaLeaves;
    608629}
  • trunk/src/VBox/VMM/VMMR3/CPUMR3Db.cpp

    r51334 r51344  
    307307static PCPUMMSRRANGE cpumR3MsrRangesEnsureSpace(PVM pVM, PCPUMMSRRANGE *ppaMsrRanges, uint32_t cMsrRanges, uint32_t cNewRanges)
    308308{
    309     uint32_t cMsrRangesAllocated = RT_ALIGN_32(cMsrRanges, 16);
     309    uint32_t cMsrRangesAllocated;
     310    if (!pVM)
     311        cMsrRangesAllocated = RT_ALIGN_32(cMsrRanges, 16);
     312    else
     313    {
     314        /*
     315         * We're using the hyper heap now, but when the range array was copied over to it from
     316         * the host-context heap, we only copy the exact size and not the ensured size.
     317         * See @bugref{7270}.
     318         */
     319        cMsrRangesAllocated = cMsrRanges;
     320    }
    310321    if (cMsrRangesAllocated < cMsrRanges + cNewRanges)
    311322    {
     
    325336                pVM->cpum.s.GuestInfo.paMsrRangesR0 = NIL_RTR0PTR;
    326337                pVM->cpum.s.GuestInfo.paMsrRangesRC = NIL_RTRCPTR;
     338                LogRel(("CPUM: cpumR3MsrRangesEnsureSpace: MMR3HyperRealloc failed. rc=%Rrc\n", rc));
    327339                return NULL;
    328340            }
    329 
    330             pVM->cpum.s.GuestInfo.paMsrRangesR0 = MMHyperR3ToR0(pVM, *ppaMsrRanges);
    331             pVM->cpum.s.GuestInfo.paMsrRangesR0 = MMHyperR3ToRC(pVM, *ppaMsrRanges);
    332             /** @todo Update R0 and RC pointers here?  */
     341            *ppaMsrRanges = (PCPUMMSRRANGE)pvNew;
    333342        }
    334343        else
     
    344353        *ppaMsrRanges = (PCPUMMSRRANGE)pvNew;
    345354    }
     355
     356    if (pVM)
     357    {
     358        /* Update R0 and RC pointers. */
     359        Assert(ppaMsrRanges == &pVM->cpum.s.GuestInfo.paMsrRangesR3);
     360        pVM->cpum.s.GuestInfo.paMsrRangesR0 = MMHyperR3ToR0(pVM, *ppaMsrRanges);
     361        pVM->cpum.s.GuestInfo.paMsrRangesRC = MMHyperR3ToRC(pVM, *ppaMsrRanges);
     362    }
     363
    346364    return *ppaMsrRanges;
    347365}
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