VirtualBox

Changeset 49808 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Dec 6, 2013 10:09:30 AM (11 years ago)
Author:
vboxsync
Message:

PATMSSM.cpp: Don't try convert non-patch memory addresses to offsets. Dropped the conversion macros since they're only used in these one cases anyway.

File:
1 edited

Legend:

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

    r49799 r49808  
    138138} PATMPATCHRECSSM, *PPATMPATCHRECSSM;
    139139
    140 /*******************************************************************************
    141 *   Defined Constants And Macros                                               *
    142 *******************************************************************************/
    143 #define PATM_SUBTRACT_PTR(a, b) *(uintptr_t *)&(a) = (uintptr_t)(a) - (uintptr_t)(b)
    144 #define PATM_ADD_PTR(a, b)      *(uintptr_t *)&(a) = (uintptr_t)(a) + (uintptr_t)(b)
    145140
    146141/*******************************************************************************
     
    555550    RTRCPTR            *pFixup = (RTRCPTR *)rec.pRelocPos;
    556551
     552    /* Convert pointer to an offset into patch memory.  May not be applicable
     553       to all fixup types, thus the UINT32_MAX. */
    557554    Assert(rec.pRelocPos);
    558     /* Convert pointer to an offset into patch memory. */
    559     PATM_SUBTRACT_PTR(rec.pRelocPos, pVM->patm.s.pPatchMemHC);
     555    uintptr_t offRelocPos = (uintptr_t)rec.pRelocPos - (uintptr_t)pVM->patm.s.pPatchMemHC;
     556    if (offRelocPos > pVM->patm.s.cbPatchMem)
     557        offRelocPos = UINT32_MAX;
     558    rec.pRelocPos = (uint8_t *)offRelocPos;
    560559
    561560    /* Zero rec.Core.Key since it's unused and may trigger SSM check due to the hack below. */
     
    991990                offset = (int32_t)(intptr_t)rec.pRelocPos;
    992991                /* Convert to HC pointer again. */
    993                 PATM_ADD_PTR(rec.pRelocPos, pVM->patm.s.pPatchMemHC);
     992                if ((uintptr_t)rec.pRelocPos < pVM->patm.s.cbPatchMem)
     993                    rec.pRelocPos = pVM->patm.s.pPatchMemHC + (uintptr_t)rec.pRelocPos;
     994                else
     995                    rec.pRelocPos = NULL;
    994996                pFixup = (RTRCPTR *)rec.pRelocPos;
    995997
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