VirtualBox

Changeset 19262 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 29, 2009 1:00:14 PM (16 years ago)
Author:
vboxsync
Message:

Introduced PDMCritSectIsOwnerEx.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r19260 r19262  
    228228}
    229229
     230/**
     231 * Checks the specified VCPU is the owner of the critical section.
     232 *
     233 * @returns true if owner.
     234 * @returns false if not owner.
     235 * @param   pCritSect   The critical section.
     236 * @param   idCpu       VCPU id
     237 */
     238VMMDECL(bool) PDMCritSectIsOwnerEx(PCPDMCRITSECT pCritSect, VMCPUID idCpu)
     239{
     240#ifdef IN_RING3
     241    NOREF(idCpu);
     242    return RTCritSectIsOwner(&pCritSect->s.Core);
     243#else
     244    PVM pVM = pCritSect->s.CTX_SUFF(pVM);
     245    Assert(pVM);
     246    Assert(idCpu < pVM->cCPUs);
     247    return pCritSect->s.Core.NativeThreadOwner == pVM->aCpus[idCpu].hNativeThread;
     248#endif
     249}
     250
    230251
    231252/**
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r18992 r19262  
    5959 *
    6060 * @param   pVM         The VM handle.
     61 * @param   pVCpu       The VMCPU handle.
    6162 *
    6263 * @remarks Must be called from within the PGM critical section. The caller
    6364 *          must clear the new pages.
    6465 */
    65 VMMR0DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM)
     66VMMR0DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM, PVMCPU pVCpu)
    6667{
    67     Assert(PDMCritSectIsOwner(&pVM->pgm.s.CritSect));
     68    Assert(PDMCritSectIsOwnerEx(&pVM->pgm.s.CritSect, pVCpu->idCpu));
    6869
    6970    /*
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r19257 r19262  
    720720            return VERR_INVALID_POINTER;
    721721        }
     722
     723        if (RT_UNLIKELY(idCpu >= pVM->cCPUs))
     724        {
     725            SUPR0Printf("vmmR0EntryExWorker: Invalid idCpu (%d vs cCPUs=%d\n", idCpu, pVM->cCPUs);
     726            return VERR_INVALID_PARAMETER;
     727        }
    722728    }
    723729
     
    831837         */
    832838        case VMMR0_DO_PGM_ALLOCATE_HANDY_PAGES:
    833             return PGMR0PhysAllocateHandyPages(pVM);
     839            return PGMR0PhysAllocateHandyPages(pVM, &pVM->aCpus[idCpu]);
    834840
    835841        /*
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