VirtualBox

Changeset 21979 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 5, 2009 11:08:09 AM (15 years ago)
Author:
vboxsync
Message:

TPR patching fixes for SMP guests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r21709 r21979  
    14021402DECLCALLBACK(int) hwaccmR3RemovePatches(PVM pVM, PVMCPU pVCpu, void *pvUser)
    14031403{
     1404    VMCPUID idCpu = (VMCPUID)pvUser;
     1405
     1406    /* Only execute the handler on the VCPU the original patch request was issued. */
     1407    if (pVCpu->idCpu != idCpu)
     1408        return VINF_SUCCESS;
     1409
    14041410    Log(("hwaccmR3RemovePatches\n"));
    14051411    for (unsigned i = 0; i < pVM->hwaccm.s.svm.cPatches; i++)
     
    14661472        return VERR_NOT_SUPPORTED;
    14671473
    1468     int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, hwaccmR3RemovePatches, NULL);
     1474    int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, hwaccmR3RemovePatches, (void *)VMMGetCpuId(pVM));
    14691475    AssertRC(rc);
    14701476
     
    14901496    Assert(pVM->hwaccm.s.cbGuestPatchMem == cbPatchMem);
    14911497
    1492     int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, hwaccmR3RemovePatches, NULL);
     1498    int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, hwaccmR3RemovePatches, (void *)VMMGetCpuId(pVM));
    14931499    AssertRC(rc);
    14941500
     
    15291535        else
    15301536        if (pDis->param2.flags == USE_IMMEDIATE32)
    1531         {
    15321537            u8Tpr = (uint8_t)pDis->param2.parval;
    1533         }
    15341538        else
    15351539            return VERR_EM_INTERPRETER;
     
    15751579DECLCALLBACK(int) hwaccmR3ReplaceTprInstr(PVM pVM, PVMCPU pVCpu, void *pvUser)
    15761580{
    1577     PCPUMCTX     pCtx   = (PCPUMCTX)pvUser;
     1581    VMCPUID      idCpu  = (VMCPUID)pvUser;
     1582    PCPUMCTX     pCtx   = CPUMQueryGuestCtxPtr(pVCpu);
    15781583    RTGCPTR      oldrip = pCtx->rip;
    15791584    PDISCPUSTATE pDis   = &pVCpu->hwaccm.s.DisState;
    15801585    unsigned     cbOp;
     1586
     1587    /* Only execute the handler on the VCPU the original patch request was issued. */
     1588    if (pVCpu->idCpu != idCpu)
     1589        return VINF_SUCCESS;
    15811590
    15821591    Log(("hwaccmR3ReplaceTprInstr: %RGv\n", pCtx->rip));
     
    17071716DECLCALLBACK(int) hwaccmR3PatchTprInstr(PVM pVM, PVMCPU pVCpu, void *pvUser)
    17081717{
    1709     PCPUMCTX     pCtx   = (PCPUMCTX)pvUser;
     1718    VMCPUID      idCpu  = (VMCPUID)pvUser;
     1719    PCPUMCTX     pCtx   = CPUMQueryGuestCtxPtr(pVCpu);
    17101720    PDISCPUSTATE pDis   = &pVCpu->hwaccm.s.DisState;
    17111721    unsigned     cbOp;
     
    17151725    char         szOutput[256];
    17161726#endif
     1727
     1728    /* Only execute the handler on the VCPU the original patch request was issued. */
     1729    if (pVCpu->idCpu != idCpu)
     1730        return VINF_SUCCESS;
    17171731
    17181732    Log(("hwaccmR3PatchTprInstr %RGv\n", pCtx->rip));
     
    19081922VMMR3DECL(int) HWACCMR3PatchTprInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
    19091923{
    1910     int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, (pVM->hwaccm.s.pGuestPatchMem) ? hwaccmR3PatchTprInstr : hwaccmR3ReplaceTprInstr, pCtx);
     1924    int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, (pVM->hwaccm.s.pGuestPatchMem) ? hwaccmR3PatchTprInstr : hwaccmR3ReplaceTprInstr, (void *)pVCpu->idCpu);
    19111925    AssertRC(rc);
    19121926    return rc;
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