VirtualBox

Changeset 20746 in vbox


Ignore:
Timestamp:
Jun 21, 2009 7:53:12 PM (15 years ago)
Author:
vboxsync
Message:

REMR3ReplayHandlerNotification,remNotifyHandlerInsert: paranoia.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/REMInternal.h

    r20430 r20746  
    109109    } u;
    110110    uint32_t                    idxSelf;
    111     uint32_t                    idxNext;
     111    uint32_t volatile           idxNext;
    112112} REMHANDLERNOTIFICATION, *PREMHANDLERNOTIFICATION;
    113113
  • trunk/src/VBox/VMM/VMMAll/REMAll.cpp

    r20431 r20746  
    100100    do
    101101    {
    102         idxFree = pVM->rem.s.idxFreeList;
     102        idxFree = ASMAtomicUoReadU32(&pVM->rem.s.idxFreeList);
    103103        if (idxFree == (uint32_t)-1)
    104104        {
     
    106106            break;
    107107        }
    108         pFree = &pVM->rem.s.aHandlerNotifications[idxFree]; 
     108        pFree = &pVM->rem.s.aHandlerNotifications[idxFree];
    109109    } while (!ASMAtomicCmpXchgU32(&pVM->rem.s.idxFreeList, pFree->idxNext, idxFree));
    110110
     
    112112    {
    113113        remFlushHandlerNotifications(pVM);
     114        /** @todo why are we dropping the pReq here without a fight? If we can drop
     115         *        one, we can drop all... */
    114116        return;
    115117    }
     
    122124    do
    123125    {
    124         idxNext = pVM->rem.s.idxPendingList;
    125         pFree->idxNext = idxNext;
     126        idxNext = ASMAtomicUoReadU32(&pVM->rem.s.idxPendingList);
     127        ASMAtomicWriteU32(&pFree->idxNext, idxNext);
     128        ASMCompilerBarrier();
    126129    } while (!ASMAtomicCmpXchgU32(&pVM->rem.s.idxPendingList, idxFree, idxNext));
    127130
    128131    VM_FF_SET(pVM, VM_FF_REM_HANDLER_NOTIFY);
    129132}
     133
    130134
    131135/**
  • trunk/src/recompiler/VBoxRecompiler.c

    r20668 r20746  
    279279     * Initialize the REM critical section.
    280280     *
    281      * Note: This is not a 100% safe solution as updating the internal memory state while another VCPU 
     281     * Note: This is not a 100% safe solution as updating the internal memory state while another VCPU
    282282     *       is executing code could be dangerous. Taking the REM lock is not an option due to the danger of
    283283     *       deadlocks. (mostly pgm vs rem locking)
     
    27252725    VM_ASSERT_EMT(pVM);
    27262726
     2727    /** @todo this isn't ensuring correct replay order. */
    27272728    if (VM_FF_TESTANDCLEAR(pVM, VM_FF_REM_HANDLER_NOTIFY_BIT))
    27282729    {
     
    27642765                case REMHANDLERNOTIFICATIONKIND_PHYSICAL_REGISTER:
    27652766                    remR3NotifyHandlerPhysicalRegister(pVM,
    2766                                                     pRec->u.PhysicalRegister.enmType,
    2767                                                     pRec->u.PhysicalRegister.GCPhys,
    2768                                                     pRec->u.PhysicalRegister.cb,
    2769                                                     pRec->u.PhysicalRegister.fHasHCHandler);
     2767                                                       pRec->u.PhysicalRegister.enmType,
     2768                                                       pRec->u.PhysicalRegister.GCPhys,
     2769                                                       pRec->u.PhysicalRegister.cb,
     2770                                                       pRec->u.PhysicalRegister.fHasHCHandler);
    27702771                    break;
    27712772
    27722773                case REMHANDLERNOTIFICATIONKIND_PHYSICAL_DEREGISTER:
    27732774                    remR3NotifyHandlerPhysicalDeregister(pVM,
    2774                                                         pRec->u.PhysicalDeregister.enmType,
    2775                                                         pRec->u.PhysicalDeregister.GCPhys,
    2776                                                         pRec->u.PhysicalDeregister.cb,
    2777                                                         pRec->u.PhysicalDeregister.fHasHCHandler,
    2778                                                         pRec->u.PhysicalDeregister.fRestoreAsRAM);
     2775                                                         pRec->u.PhysicalDeregister.enmType,
     2776                                                         pRec->u.PhysicalDeregister.GCPhys,
     2777                                                         pRec->u.PhysicalDeregister.cb,
     2778                                                         pRec->u.PhysicalDeregister.fHasHCHandler,
     2779                                                         pRec->u.PhysicalDeregister.fRestoreAsRAM);
    27792780                    break;
    27802781
    27812782                case REMHANDLERNOTIFICATIONKIND_PHYSICAL_MODIFY:
    27822783                    remR3NotifyHandlerPhysicalModify(pVM,
    2783                                                     pRec->u.PhysicalModify.enmType,
    2784                                                     pRec->u.PhysicalModify.GCPhysOld,
    2785                                                     pRec->u.PhysicalModify.GCPhysNew,
    2786                                                     pRec->u.PhysicalModify.cb,
    2787                                                     pRec->u.PhysicalModify.fHasHCHandler,
    2788                                                     pRec->u.PhysicalModify.fRestoreAsRAM);
     2784                                                     pRec->u.PhysicalModify.enmType,
     2785                                                     pRec->u.PhysicalModify.GCPhysOld,
     2786                                                     pRec->u.PhysicalModify.GCPhysNew,
     2787                                                     pRec->u.PhysicalModify.cb,
     2788                                                     pRec->u.PhysicalModify.fHasHCHandler,
     2789                                                     pRec->u.PhysicalModify.fRestoreAsRAM);
    27892790                    break;
    27902791
     
    28062807            do
    28072808            {
    2808                 idxNext = pVM->rem.s.idxFreeList;
    2809                 pRec->idxNext = idxNext;
     2809                idxNext = ASMAtomicUoReadU32(&pVM->rem.s.idxFreeList);
     2810                ASMAtomicWriteU32(&pRec->idxNext, idxNext);
     2811                ASMCompilerBarrier();
    28102812            } while (!ASMAtomicCmpXchgU32(&pVM->rem.s.idxFreeList, pRec->idxSelf, idxNext));
    28112813        }
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