VirtualBox

Changeset 13936 in vbox


Ignore:
Timestamp:
Nov 6, 2008 8:44:09 PM (16 years ago)
Author:
vboxsync
Message:

PGM: removed a bunch of unnecessary RTGCUINTPTR/RTGCPTR casts. (RTGCPTR used to be void * in RC, now RTGCUINTPTR == RTGCPTR.)

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

Legend:

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

    r13933 r13936  
    18151815    }
    18161816    /* A bit of paranoia is justified. */
    1817     AssertRelease((RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[0] + PAGE_SIZE == (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[1]);
    1818     AssertRelease((RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[1] + PAGE_SIZE == (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[2]);
    1819     AssertRelease((RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[2] + PAGE_SIZE == (RTGCUINTPTR)pVM->pgm.s.apGCPaePDs[3]);
     1817    AssertRelease(pVM->pgm.s.apGCPaePDs[0] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[1]);
     1818    AssertRelease(pVM->pgm.s.apGCPaePDs[1] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[2]);
     1819    AssertRelease(pVM->pgm.s.apGCPaePDs[2] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[3]);
    18201820    GCPtr += PAGE_SIZE; /* reserved page */
    18211821
  • trunk/src/VBox/VMM/PGMBth.h

    r13818 r13936  
    3535PGM_BTH_DECL(int, InvalidatePage)(PVM pVM, RTGCPTR GCPtrPage);
    3636PGM_BTH_DECL(int, PrefetchPage)(PVM pVM, RTGCUINTPTR GCPtrPage);
    37 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGCUINTPTR)0);
     37PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr = 0, RTGCPTR cb = ~(RTGCPTR)0);
    3838__END_DECLS
    3939
  • trunk/src/VBox/VMM/PGMDbg.cpp

    r13040 r13936  
    459459    const RTGCUINTPTR   GCPtrLast = GCPtr + cbRange - 1 >= GCPtr
    460460                                  ? GCPtr + cbRange - 1
    461                                   : ~(RTGCUINTPTR)0;
     461                                  : ~(RTGCPTR)0;
    462462    RTGCUINTPTR         cPages = (((GCPtrLast - GCPtr) + (GCPtr & PAGE_OFFSET_MASK)) >> PAGE_SHIFT) + 1;
    463463    while (cPages-- > 0)
     
    474474                void const *pvPage;
    475475                PGMPAGEMAPLOCK Lock;
    476                 rc = PGMPhysGCPhys2CCPtrReadOnly(pVM, GCPhys & ~(RTGCUINTPTR)PAGE_OFFSET_MASK, &pvPage, &Lock);
     476                rc = PGMPhysGCPhys2CCPtrReadOnly(pVM, GCPhys & ~(RTGCPTR)PAGE_OFFSET_MASK, &pvPage, &Lock);
    477477                if (RT_SUCCESS(rc))
    478478                {
     
    486486                    if (fRc)
    487487                    {
    488                         *pGCPtrHit = (GCPtr & ~(RTGCUINTPTR)PAGE_OFFSET_MASK) + offPage;
     488                        *pGCPtrHit = (GCPtr & ~(RTGCPTR)PAGE_OFFSET_MASK) + offPage;
    489489                        return VINF_SUCCESS;
    490490                    }
  • trunk/src/VBox/VMM/PGMHandler.cpp

    r13823 r13936  
    323323     * Allocate and initialize a new entry.
    324324     */
    325     unsigned cPages = (RT_ALIGN((RTGCUINTPTR)GCPtrLast + 1, PAGE_SIZE) - ((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK)) >> PAGE_SHIFT;
     325    unsigned cPages = (RT_ALIGN(GCPtrLast + 1, PAGE_SIZE) - (GCPtr & PAGE_BASE_GC_MASK)) >> PAGE_SHIFT;
    326326    PPGMVIRTHANDLER pNew;
    327327    int rc = MMHyperAlloc(pVM, RT_OFFSETOF(PGMVIRTHANDLER, aPhysToVirt[cPages]), 0, MM_TAG_PGM_HANDLERS, (void **)&pNew); /** @todo r=bird: incorrect member name PhysToVirt? */
  • trunk/src/VBox/VMM/PGMInternal.h

    r13935 r13936  
    19121912    DECLR3CALLBACKMEMBER(int,       pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
    19131913#ifdef VBOX_STRICT
    1914     DECLR3CALLBACKMEMBER(unsigned,  pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
     1914    DECLR3CALLBACKMEMBER(unsigned,  pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb));
    19151915#endif
    19161916
     
    19221922    DECLRCCALLBACKMEMBER(int,       pfnRCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
    19231923#ifdef VBOX_STRICT
    1924     DECLRCCALLBACKMEMBER(unsigned,  pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
     1924    DECLRCCALLBACKMEMBER(unsigned,  pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb));
    19251925#endif
    19261926
     
    19321932    DECLR0CALLBACKMEMBER(int,       pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
    19331933#ifdef VBOX_STRICT
    1934     DECLR0CALLBACKMEMBER(unsigned,  pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
     1934    DECLR0CALLBACKMEMBER(unsigned,  pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb));
    19351935#endif
    19361936    /** @} */
     
    21822182    DECLR3CALLBACKMEMBER(int,       pfnR3BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    21832183    DECLR3CALLBACKMEMBER(int,       pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
    2184     DECLR3CALLBACKMEMBER(unsigned,  pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
     2184    DECLR3CALLBACKMEMBER(unsigned,  pfnR3BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb));
    21852185
    21862186    DECLR0CALLBACKMEMBER(int,       pfnR0BthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
     
    21902190    DECLR0CALLBACKMEMBER(int,       pfnR0BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    21912191    DECLR0CALLBACKMEMBER(int,       pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
    2192     DECLR0CALLBACKMEMBER(unsigned,  pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
     2192    DECLR0CALLBACKMEMBER(unsigned,  pfnR0BthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb));
    21932193
    21942194    DECLRCCALLBACKMEMBER(int,       pfnRCBthTrap0eHandler,(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault));
     
    21982198    DECLRCCALLBACKMEMBER(int,       pfnRCBthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    21992199    DECLRCCALLBACKMEMBER(int,       pfnRCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
    2200     DECLRCCALLBACKMEMBER(unsigned,  pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb));
     2200    DECLRCCALLBACKMEMBER(unsigned,  pfnRCBthAssertCR3,(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb));
    22012201#if HC_ARCH_BITS == 64
    22022202    RTRCPTR                         alignment2; /**< structure size alignment. */
  • trunk/src/VBox/VMM/PGMMap.cpp

    r13930 r13936  
    11591159    while (pCur)
    11601160    {
    1161         RTGCUINTPTR off = (RTGCUINTPTR)GCPtrSrc - (RTGCUINTPTR)pCur->GCPtr;
     1161        RTGCUINTPTR off = GCPtrSrc - pCur->GCPtr;
    11621162        if (off < pCur->cb)
    11631163        {
  • trunk/src/VBox/VMM/PGMShw.h

    r13819 r13936  
    8181PGM_SHW_DECL(int, InitData)(PVM pVM, PPGMMODEDATA pModeData, bool fResolveGCAndR0);
    8282PGM_SHW_DECL(int, Enter)(PVM pVM);
    83 PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGCUINTPTR offDelta);
     83PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGCPTR offDelta);
    8484PGM_SHW_DECL(int, Exit)(PVM pVM);
    8585
    8686/* all */
    87 PGM_SHW_DECL(int, GetPage)(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
    88 PGM_SHW_DECL(int, ModifyPage)(PVM pVM, RTGCUINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
     87PGM_SHW_DECL(int, GetPage)(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys);
     88PGM_SHW_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
    8989__END_DECLS
    9090
     
    157157 * @param   offDelta    The reloation offset.
    158158 */
    159 PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGCUINTPTR offDelta)
     159PGM_SHW_DECL(int, Relocate)(PVM pVM, RTGCPTR offDelta)
    160160{
    161161    /* nothing special to do here - InitData does the job. */
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r13935 r13936  
    435435{
    436436    STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,Prefetch), a);
    437     int rc = PGM_BTH_PFN(PrefetchPage, pVM)(pVM, (RTGCUINTPTR)GCPtrPage);
     437    int rc = PGM_BTH_PFN(PrefetchPage, pVM)(pVM, GCPtrPage);
    438438    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,Prefetch), a);
    439439    AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 || RT_FAILURE(rc), ("rc=%Rrc\n", rc));
     
    745745VMMDECL(int) PGMShwGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys)
    746746{
    747     return PGM_SHW_PFN(GetPage,pVM)(pVM, (RTGCUINTPTR)GCPtr, pfFlags, pHCPhys);
     747    return PGM_SHW_PFN(GetPage,pVM)(pVM, GCPtr, pfFlags, pHCPhys);
    748748}
    749749
     
    787787     * Align the input.
    788788     */
    789     cb     += (RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK;
     789    cb     += GCPtr & PAGE_OFFSET_MASK;
    790790    cb      = RT_ALIGN_Z(cb, PAGE_SIZE);
    791     GCPtr   = (RTGCPTR)((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK); /** @todo this ain't necessary, right... */
     791    GCPtr   = (GCPtr & PAGE_BASE_GC_MASK); /** @todo this ain't necessary, right... */
    792792
    793793    /*
    794794     * Call worker.
    795795     */
    796     return PGM_SHW_PFN(ModifyPage, pVM)(pVM, (RTGCUINTPTR)GCPtr, cb, fFlags, fMask);
     796    return PGM_SHW_PFN(ModifyPage, pVM)(pVM, GCPtr, cb, fFlags, fMask);
    797797}
    798798
     
    11501150VMMDECL(int) PGMGstGetPage(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys)
    11511151{
    1152     return PGM_GST_PFN(GetPage,pVM)(pVM, (RTGCUINTPTR)GCPtr, pfFlags, pGCPhys);
     1152    return PGM_GST_PFN(GetPage,pVM)(pVM, GCPtr, pfFlags, pGCPhys);
    11531153}
    11541154
     
    12121212     * Adjust input.
    12131213     */
    1214     cb     += (RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK;
     1214    cb     += GCPtr & PAGE_OFFSET_MASK;
    12151215    cb      = RT_ALIGN_Z(cb, PAGE_SIZE);
    1216     GCPtr   = (RTGCPTR)((RTGCUINTPTR)GCPtr & PAGE_BASE_GC_MASK);
     1216    GCPtr   = (GCPtr & PAGE_BASE_GC_MASK);
    12171217
    12181218    /*
    12191219     * Call worker.
    12201220     */
    1221     int rc = PGM_GST_PFN(ModifyPage, pVM)(pVM, (RTGCUINTPTR)GCPtr, cb, fFlags, fMask);
     1221    int rc = PGM_GST_PFN(ModifyPage, pVM)(pVM, GCPtr, cb, fFlags, fMask);
    12221222
    12231223    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,GstModifyPage), a);
     
    20092009    {
    20102010        /** @todo This is slow and should be optimized, but since it's just assertions I don't care now. */
    2011         for (RTGCUINTPTR GCPtr = (RTGCUINTPTR)pMapping->GCPtr;
    2012               GCPtr <= (RTGCUINTPTR)pMapping->GCPtrLast;
     2011        for (RTGCUINTPTR GCPtr = pMapping->GCPtr;
     2012              GCPtr <= pMapping->GCPtrLast;
    20132013              GCPtr += PAGE_SIZE)
    20142014        {
     
    20422042{
    20432043    STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a);
    2044     unsigned cErrors = PGM_BTH_PFN(AssertCR3, pVM)(pVM, cr3, cr4, 0, ~(RTGCUINTPTR)0);
     2044    unsigned cErrors = PGM_BTH_PFN(AssertCR3, pVM)(pVM, cr3, cr4, 0, ~(RTGCPTR)0);
    20452045    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncCR3), a);
    20462046    return cErrors;
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r13935 r13936  
    3535PGM_BTH_DECL(int, SyncCR3)(PVM pVM, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal);
    3636#ifdef VBOX_STRICT
    37 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGCUINTPTR)0);
     37PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGCPTR)0);
    3838#endif
    3939#ifdef PGMPOOL_WITH_USER_TRACKING
     
    102102#  if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
    103103#   if PGM_GST_TYPE == PGM_TYPE_32BIT
    104     const unsigned  iPDSrc = (RTGCUINTPTR)pvFault >> GST_PD_SHIFT;
     104    const unsigned  iPDSrc = pvFault >> GST_PD_SHIFT;
    105105    PGSTPD          pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s);
    106106
     
    109109#    if PGM_GST_TYPE == PGM_TYPE_PAE
    110110    unsigned        iPDSrc;
    111     PGSTPD          pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, (RTGCUINTPTR)pvFault, &iPDSrc, NULL);
     111    PGSTPD          pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, pvFault, &iPDSrc, NULL);
    112112
    113113#    elif PGM_GST_TYPE == PGM_TYPE_AMD64
     
    124124    {
    125125#    if PGM_GST_TYPE == PGM_TYPE_AMD64 && GC_ARCH_BITS == 64
    126         LogFlow(("Trap0eHandler: guest PML4 %d not present CR3=%RGp\n", (int)(((RTGCUINTPTR)pvFault >> X86_PML4_SHIFT) & X86_PML4_MASK), CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK));
     126        LogFlow(("Trap0eHandler: guest PML4 %d not present CR3=%RGp\n", (int)((pvFault >> X86_PML4_SHIFT) & X86_PML4_MASK), CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK));
    127127#    else
    128128        LogFlow(("Trap0eHandler: guest iPDSrc=%u not present CR3=%RGp\n", iPDSrc, CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK));
     
    141141
    142142#  if PGM_SHW_TYPE == PGM_TYPE_32BIT
    143     const unsigned  iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT;
     143    const unsigned  iPDDst = pvFault >> SHW_PD_SHIFT;
    144144    PX86PD          pPDDst = pVM->pgm.s.CTXMID(p,32BitPD);
    145145
    146146#  elif PGM_SHW_TYPE == PGM_TYPE_PAE
    147     const unsigned  iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT;
     147    const unsigned  iPDDst = pvFault >> SHW_PD_SHIFT;
    148148    PX86PDPAE       pPDDst = pVM->pgm.s.CTXMID(ap,PaePDs)[0];       /* We treat this as a PD with 2048 entries, so no need to and with SHW_PD_MASK to get iPDDst */
    149149
    150150#   if PGM_GST_TYPE == PGM_TYPE_PAE
    151151    /* Did we mark the PDPT as not present in SyncCR3? */
    152     unsigned iPdpte = ((RTGCUINTPTR)pvFault >> SHW_PDPT_SHIFT) & SHW_PDPT_MASK;
     152    unsigned iPdpte = (pvFault >> SHW_PDPT_SHIFT) & SHW_PDPT_MASK;
    153153    if (!pVM->pgm.s.CTXMID(p,PaePDPT)->a[iPdpte].n.u1Present)
    154154        pVM->pgm.s.CTXMID(p,PaePDPT)->a[iPdpte].n.u1Present = 1;
     
    157157
    158158#  elif PGM_SHW_TYPE == PGM_TYPE_AMD64
    159     const unsigned  iPDDst = (((RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);
     159    const unsigned  iPDDst = ((pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);
    160160    PX86PDPAE       pPDDst;
    161161#   if PGM_GST_TYPE == PGM_TYPE_PROT
     
    170170#   endif
    171171
    172     rc = PGMShwSyncLongModePDPtr(pVM, (RTGCUINTPTR)pvFault, pPml4eSrc, &PdpeSrc, &pPDDst);
     172    rc = PGMShwSyncLongModePDPtr(pVM, pvFault, pPml4eSrc, &PdpeSrc, &pPDDst);
    173173    if (rc != VINF_SUCCESS)
    174174    {
     
    179179
    180180#  elif PGM_SHW_TYPE == PGM_TYPE_EPT
    181     const unsigned  iPDDst = (((RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);
     181    const unsigned  iPDDst = ((pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);
    182182    PEPTPD          pPDDst;
    183183
    184     rc = PGMShwGetEPTPDPtr(pVM, (RTGCUINTPTR)pvFault, NULL, &pPDDst);
     184    rc = PGMShwGetEPTPDPtr(pVM, pvFault, NULL, &pPDDst);
    185185    if (rc != VINF_SUCCESS)
    186186    {
     
    197197     */
    198198    STAM_PROFILE_START(&pVM->pgm.s.StatRZTrap0eTimeCheckPageFault, e);
    199     rc = PGM_BTH_NAME(CheckPageFault)(pVM, uErr, &pPDDst->a[iPDDst], &pPDSrc->a[iPDSrc], (RTGCUINTPTR)pvFault);
     199    rc = PGM_BTH_NAME(CheckPageFault)(pVM, uErr, &pPDDst->a[iPDDst], &pPDSrc->a[iPDSrc], pvFault);
    200200    STAM_PROFILE_STOP(&pVM->pgm.s.StatRZTrap0eTimeCheckPageFault, e);
    201201    if (    rc == VINF_PGM_HANDLED_DIRTY_BIT_FAULT
     
    241241        STAM_PROFILE_START(&pVM->pgm.s.StatRZTrap0eTimeSyncPT, f);
    242242        LogFlow(("=>SyncPT %04x = %08x\n", iPDSrc, PdeSrc.au32[0]));
    243         rc = PGM_BTH_NAME(SyncPT)(pVM, iPDSrc, pPDSrc, (RTGCUINTPTR)pvFault);
     243        rc = PGM_BTH_NAME(SyncPT)(pVM, iPDSrc, pPDSrc, pvFault);
    244244        if (RT_SUCCESS(rc))
    245245        {
     
    267267        for ( ; pMapping; pMapping = pMapping->CTX_SUFF(pNext))
    268268        {
    269             if ((RTGCUINTPTR)pvFault < (RTGCUINTPTR)pMapping->GCPtr)
     269            if (pvFault < pMapping->GCPtr)
    270270                break;
    271             if ((RTGCUINTPTR)pvFault - (RTGCUINTPTR)pMapping->GCPtr < pMapping->cb)
     271            if (pvFault - pMapping->GCPtr < pMapping->cb)
    272272            {
    273273                /*
     
    293293                PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers, pvFault);
    294294                if (    pCur
    295                     &&  (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb
     295                    &&  pvFault - pCur->Core.Key < pCur->cb
    296296                    &&  uErr & X86_TRAP_PF_RW)
    297297                {
    298298#   ifdef IN_RC
    299299                    STAM_PROFILE_START(&pCur->Stat, h);
    300                     rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key);
     300                    rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key);
    301301                    STAM_PROFILE_STOP(&pCur->Stat, h);
    302302#   else
     
    351351            if (RT_SUCCESS(rc))
    352352            {
    353                 unsigned iPTESrc = ((RTGCUINTPTR)pvFault >> GST_PT_SHIFT) & GST_PT_MASK;
     353                unsigned iPTESrc = (pvFault >> GST_PT_SHIFT) & GST_PT_MASK;
    354354                if (pPTSrc->a[iPTESrc].n.u1Present)
    355355                    GCPhys = pPTSrc->a[iPTESrc].u & GST_PTE_PG_MASK;
     
    358358#  else
    359359        /* No paging so the fault address is the physical address */
    360         GCPhys = (RTGCPHYS)((RTGCUINTPTR)pvFault & ~PAGE_OFFSET_MASK);
     360        GCPhys = (RTGCPHYS)(pvFault & ~PAGE_OFFSET_MASK);
    361361#  endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */
    362362
     
    380380                         * Physical page access handler.
    381381                         */
    382                         const RTGCPHYS  GCPhysFault = GCPhys | ((RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK);
     382                        const RTGCPHYS  GCPhysFault = GCPhys | (pvFault & PAGE_OFFSET_MASK);
    383383                        PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhysFault);
    384384                        if (pCur)
     
    395395                                && !(uErr & X86_TRAP_PF_P))
    396396                            {
    397                                 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);
     397                                rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr);
    398398                                if (    RT_FAILURE(rc)
    399399                                    || !(uErr & X86_TRAP_PF_RW)
     
    441441                            && !(uErr & X86_TRAP_PF_P))
    442442                        {
    443                             rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);
     443                            rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr);
    444444                            if (    RT_FAILURE(rc)
    445445                                ||  rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE
     
    467467                        if (pCur)
    468468                        {
    469                             AssertMsg(!((RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb)
     469                            AssertMsg(!(pvFault - pCur->Core.Key < pCur->cb)
    470470                                      || (     pCur->enmType != PGMVIRTHANDLERTYPE_WRITE
    471471                                           || !(uErr & X86_TRAP_PF_P)
     
    473473                                      ("Unexpected trap for virtual handler: %RGv (phys=%RGp) HCPhys=%HGp uErr=%X, enum=%d\n", pvFault, GCPhys, pPage->HCPhys, uErr, pCur->enmType));
    474474
    475                             if (    (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb
     475                            if (    pvFault - pCur->Core.Key < pCur->cb
    476476                                &&  (    uErr & X86_TRAP_PF_RW
    477477                                     ||  pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) )
     
    479479#   ifdef IN_RC
    480480                                STAM_PROFILE_START(&pCur->Stat, h);
    481                                 rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key);
     481                                rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key);
    482482                                STAM_PROFILE_STOP(&pCur->Stat, h);
    483483#   else
     
    496496                            PPGMVIRTHANDLER pCur;
    497497                            unsigned        iPage;
    498                             rc = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys + ((RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK),
     498                            rc = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys + (pvFault & PAGE_OFFSET_MASK),
    499499                                                                 &pCur, &iPage);
    500500                            Assert(RT_SUCCESS(rc) || !pCur);
     
    505505                                Assert((pCur->aPhysToVirt[iPage].Core.Key & X86_PTE_PAE_PG_MASK) == GCPhys);
    506506#   ifdef IN_RC
    507                                 RTGCUINTPTR off = (iPage << PAGE_SHIFT) + ((RTGCUINTPTR)pvFault & PAGE_OFFSET_MASK) - ((RTGCUINTPTR)pCur->Core.Key & PAGE_OFFSET_MASK);
     507                                RTGCUINTPTR off = (iPage << PAGE_SHIFT) + (pvFault & PAGE_OFFSET_MASK) - (pCur->Core.Key & PAGE_OFFSET_MASK);
    508508                                Assert(off < pCur->cb);
    509509                                STAM_PROFILE_START(&pCur->Stat, h);
     
    535535                        &&  !(uErr & X86_TRAP_PF_P))
    536536                    {
    537                         rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);
     537                        rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr);
    538538                        if (    RT_FAILURE(rc)
    539539                            ||  rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE
     
    574574                    if (pCur)
    575575                    {
    576                         AssertMsg(   !((RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb)
     576                        AssertMsg(   !(pvFault - pCur->Core.Key < pCur->cb)
    577577                                  || (    pCur->enmType != PGMVIRTHANDLERTYPE_WRITE
    578578                                       || !(uErr & X86_TRAP_PF_P)
     
    580580                                  ("Unexpected trap for virtual handler: %08X (phys=%08x) HCPhys=%X uErr=%X, enum=%d\n", pvFault, GCPhys, pPage->HCPhys, uErr, pCur->enmType));
    581581
    582                         if (    (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key < pCur->cb
     582                        if (    pvFault - pCur->Core.Key < pCur->cb
    583583                            &&  (    uErr & X86_TRAP_PF_RW
    584584                                 ||  pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) )
     
    586586#   ifdef IN_RC
    587587                            STAM_PROFILE_START(&pCur->Stat, h);
    588                             rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, (RTGCUINTPTR)pvFault - (RTGCUINTPTR)pCur->Core.Key);
     588                            rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key);
    589589                            STAM_PROFILE_STOP(&pCur->Stat, h);
    590590#   else
     
    651651                        /* Note: can't check for X86_TRAP_ID bit, because that requires execute disable support on the CPU */
    652652                        if (    pvFault == (RTGCPTR)pRegFrame->eip
    653                             ||  (RTGCUINTPTR)pvFault - pRegFrame->eip < 8    /* instruction crossing a page boundary */
     653                            ||  pvFault - pRegFrame->eip < 8    /* instruction crossing a page boundary */
    654654#    ifdef CSAM_DETECT_NEW_CODE_PAGES
    655655                            ||  (   !PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip)
     
    669669                                 */
    670670                                LogFlow(("CSAM ring 3 job\n"));
    671                                 int rc2 = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, 1, uErr);
     671                                int rc2 = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, 1, uErr);
    672672                                AssertRC(rc2);
    673673
     
    695695                                DISCPUSTATE Cpu;
    696696                                uint32_t    cbOp;
    697                                 rc = EMInterpretDisasOneEx(pVM, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);
     697                                rc = EMInterpretDisasOneEx(pVM, PC, pRegFrame, &Cpu, &cbOp);
    698698
    699699                                /* For now we'll restrict this to rep movsw/d instructions */
     
    717717                }
    718718#   endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) */
    719                 rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);
     719                rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr);
    720720                if (RT_SUCCESS(rc))
    721721                {
     
    744744                     * Note: Do NOT use PGM_SYNC_NR_PAGES here. That only works if the page is not present, which is not true in this case.
    745745                     */
    746                     rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, 1, uErr);
     746                    rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, pvFault, 1, uErr);
    747747                    if (RT_SUCCESS(rc))
    748748                    {
     
    16951695                            {
    16961696                                GSTPTE PteSrc = pPTSrc->a[offPTSrc + iPTDst];
    1697                                 RTGCUINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);
     1697                                RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);
    16981698                                NOREF(GCPtrCurPage);
    16991699#ifndef IN_RING0
     
    17501750                 */
    17511751                /* Calculate the GC physical address of this 4KB shadow page. */
    1752                 RTGCPHYS GCPhys = GST_GET_PDE_BIG_PG_GCPHYS(PdeSrc) | ((RTGCUINTPTR)GCPtrPage & GST_BIG_PAGE_OFFSET_MASK);
     1752                RTGCPHYS GCPhys = GST_GET_PDE_BIG_PG_GCPHYS(PdeSrc) | (GCPtrPage & GST_BIG_PAGE_OFFSET_MASK);
    17531753                /* Find ram range. */
    17541754                PPGMPAGE pPage;
     
    19111911                GSTPTE PteSrc;
    19121912
    1913                 RTGCUINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT);
     1913                RTGCUINTPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT);
    19141914
    19151915                /* Fake the page table entry */
     
    19321932            }
    19331933            else
    1934                 Log4(("%RGv iPTDst=%x pPTDst->a[iPTDst] %RX64\n", ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT), iPTDst, pPTDst->a[iPTDst].u));
     1934                Log4(("%RGv iPTDst=%x pPTDst->a[iPTDst] %RX64\n", (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT), iPTDst, pPTDst->a[iPTDst].u));
    19351935        }
    19361936    }
     
    19401940        GSTPTE PteSrc;
    19411941        const unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK;
    1942         RTGCUINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT);
     1942        RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(SHW_PT_MASK << SHW_PT_SHIFT)) | (iPTDst << PAGE_SHIFT);
    19431943
    19441944        /* Fake the page table entry */
     
    27792779    *pPdeDst = PdeDst;
    27802780
    2781     rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)GCPtrPage, PGM_SYNC_NR_PAGES, 0 /* page not present */);
     2781    rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, GCPtrPage, PGM_SYNC_NR_PAGES, 0 /* page not present */);
    27822782    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,SyncPT), a);
    27832783    return rc;
     
    28132813# if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
    28142814#  if PGM_GST_TYPE == PGM_TYPE_32BIT
    2815     const unsigned  iPDSrc = (RTGCUINTPTR)GCPtrPage >> GST_PD_SHIFT;
     2815    const unsigned  iPDSrc = GCPtrPage >> GST_PD_SHIFT;
    28162816    PGSTPD          pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s);
    28172817#  elif PGM_GST_TYPE == PGM_TYPE_PAE
     
    29322932# if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
    29332933#  if PGM_GST_TYPE == PGM_TYPE_32BIT
    2934     const unsigned  iPDSrc = (RTGCUINTPTR)GCPtrPage >> GST_PD_SHIFT;
     2934    const unsigned  iPDSrc = GCPtrPage >> GST_PD_SHIFT;
    29352935    PGSTPD          pPDSrc = pgmGstGet32bitPDPtr(&pVM->pgm.s);
    29362936#  elif PGM_GST_TYPE == PGM_TYPE_PAE
     
    36203620 * @param   cb          How much to check. Defaults to everything.
    36213621 */
    3622 PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb)
     3622PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPTR GCPtr, RTGCPTR cb)
    36233623{
    36243624#if PGM_SHW_TYPE == PGM_TYPE_NESTED || PGM_SHW_TYPE == PGM_TYPE_EPT
     
    36903690    unsigned        cIncrement  = X86_PG_PAE_ENTRIES * PAGE_SIZE;
    36913691# endif
    3692     if (cb != ~(RTGCUINTPTR)0)
     3692    if (cb != ~(RTGCPTR)0)
    36933693        cPDEs = RT_MIN(cb >> SHW_PD_SHIFT, 1);
    36943694
  • trunk/src/VBox/VMM/VMMAll/PGMAllGst.h

    r13935 r13936  
    126126*******************************************************************************/
    127127__BEGIN_DECLS
    128 PGM_GST_DECL(int, GetPage)(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys);
    129 PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCUINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
    130 PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCUINTPTR GCPtr, PX86PDEPAE pPDE);
     128PGM_GST_DECL(int, GetPage)(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys);
     129PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
     130PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCPTR GCPtr, PX86PDEPAE pPDE);
    131131PGM_GST_DECL(int, MapCR3)(PVM pVM, RTGCPHYS GCPhysCR3);
    132132PGM_GST_DECL(int, UnmapCR3)(PVM pVM);
     
    160160 *                      This is page aligned. The fact that the
    161161 */
    162 PGM_GST_DECL(int, GetPage)(PVM pVM, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys)
     162PGM_GST_DECL(int, GetPage)(PVM pVM, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys)
    163163{
    164164#if PGM_GST_TYPE == PGM_TYPE_REAL \
     
    290290 * @param   fMask       The AND mask - page flags X86_PTE_*.
    291291 */
    292 PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCUINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask)
     292PGM_GST_DECL(int, ModifyPage)(PVM pVM, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask)
    293293{
    294294#if PGM_GST_TYPE == PGM_TYPE_32BIT \
     
    394394 * @param   pPDE        Pointer to guest PDE structure
    395395 */
    396 PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCUINTPTR GCPtr, PX86PDEPAE pPDE)
     396PGM_GST_DECL(int, GetPDE)(PVM pVM, RTGCPTR GCPtr, PX86PDEPAE pPDE)
    397397{
    398398#if PGM_GST_TYPE == PGM_TYPE_32BIT \
     
    447447    if (RT_SUCCESS(rc))
    448448    {
    449         rc = PGMMap(pVM, (RTGCUINTPTR)pVM->pgm.s.GCPtrCR3Mapping, HCPhysGuestCR3, PAGE_SIZE, 0);
     449        rc = PGMMap(pVM, (RTGCPTR)pVM->pgm.s.GCPtrCR3Mapping, HCPhysGuestCR3, PAGE_SIZE, 0);
    450450        if (RT_SUCCESS(rc))
    451451        {
     
    471471             */
    472472            PX86PDPT pGuestPDPT = pgmGstGetPaePDPTPtr(&pVM->pgm.s);
    473             RTGCUINTPTR GCPtr = (RTGCUINTPTR)pVM->pgm.s.GCPtrCR3Mapping + PAGE_SIZE;
     473            RTGCPTR GCPtr = pVM->pgm.s.GCPtrCR3Mapping + PAGE_SIZE;
    474474            for (unsigned i = 0; i < X86_PG_PAE_PDPE_ENTRIES; i++, GCPtr += PAGE_SIZE)
    475475            {
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