VirtualBox

Changeset 11370

Show
Ignore:
Timestamp:
08/12/08 19:50:18 (3 months ago)
Author:
vboxsync
Message:

Deal with flushing of pgm pool pages when an injected event triggers faults on the stack

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/hwaccm.h

    r10822 r11370  
    7575HWACCMDECL(int) HWACCMInvalidatePage(PVM pVM, RTGCPTR GCVirt); 
    7676 
     77/** 
     78 * Checks if an interrupt event is currently pending.  
     79 * 
     80 * @returns Interrupt event pending state. 
     81 * @param   pVM         The VM to operate on. 
     82 */ 
     83HWACCMDECL(bool) HWACCMHasPendingIrq(PVM pVM); 
     84 
    7785#ifndef IN_GC 
    7886/** 
  • trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp

    r10822 r11370  
    7373    if (pVM->hwaccm.s.svm.fSupported) 
    7474    { 
     75        Log(("HWACCMFlushTLB\n")); 
    7576        pVM->hwaccm.s.svm.fForceTLBFlush = true; 
    7677        STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBManual); 
     
    130131    return VINF_SUCCESS; 
    131132} 
     133 
     134/** 
     135 * Checks if an interrupt event is currently pending.  
     136 * 
     137 * @returns Interrupt event pending state. 
     138 * @param   pVM         The VM to operate on. 
     139 */ 
     140HWACCMDECL(bool) HWACCMHasPendingIrq(PVM pVM) 
     141{ 
     142    return pVM->hwaccm.s.Event.fPending; 
     143} 
     144 
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r11366 r11370  
    692692 * @returns true if we consider the page as being reused for a different purpose. 
    693693 * @returns false if we consider it to still be a paging page. 
     694 * @param   pVM         VM Handle. 
    694695 * @param   pPage       The page in question. 
    695696 * @param   pRegFrame   Trap register frame. 
    696  * @param   pCpu        The disassembly info for the faulting insturction. 
     697 * @param   pCpu        The disassembly info for the faulting instruction. 
    697698 * @param   pvFault     The fault address. 
    698699 * 
    699700 * @remark  The REP prefix check is left to the caller because of STOSD/W. 
    700701 */ 
    701 DECLINLINE(bool) pgmPoolMonitorIsReused(PPGMPOOLPAGE pPage, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR pvFault) 
    702 
     702DECLINLINE(bool) pgmPoolMonitorIsReused(PVM pVM, PPGMPOOLPAGE pPage, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR pvFault) 
     703
     704#ifndef IN_GC 
     705    if (   HWACCMHasPendingIrq(pVM) 
     706        && (pRegFrame->rsp - pvFault) < 32) 
     707    { 
     708        /* Fault caused by stack writes while trying to inject an interrupt event. */ 
     709        Log(("pgmPoolMonitorIsReused: reused %VGv for interrupt stack (rsp=%VGv).\n", pvFault, pRegFrame->rsp)); 
     710        return true; 
     711    } 
     712#else 
     713    NOREF(pVM); 
     714#endif 
     715 
    703716    switch (pCpu->pCurInstr->opcode) 
    704717    { 
     
    958971    if (    (   pPage->cModifications < 48   /** @todo #define */ /** @todo need to check that it's not mapping EIP. */ /** @todo adjust this! */ 
    959972             || pPage->fCR3Mix) 
    960         &&  !(fReused = pgmPoolMonitorIsReused(pPage, pRegFrame, &Cpu, pvFault)) 
     973        &&  !(fReused = pgmPoolMonitorIsReused(pVM, pPage, pRegFrame, &Cpu, pvFault)) 
    961974        &&  !pgmPoolMonitorIsForking(pPool, &Cpu, GCPhysFault & PAGE_OFFSET_MASK)) 
    962975    { 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy