VirtualBox

儲存庫 vbox 的更動 4679


忽略:
時間撮記:
2007-9-10 下午04:04:46 (17 年 以前)
作者:
vboxsync
訊息:

Corrected PGMPhysGCPtr2GCPhys to respect the page offset.

位置:
trunk
檔案:
修改 3 筆資料

圖例:

未更動
新增
刪除
  • trunk/include/VBox/pgm.h

    r4665 r4679  
    838838 * @param   pVM         The VM Handle
    839839 * @param   GCPtr       The guest pointer to convert.
    840  * @param   pGCPhys     Where to store the HC physical address.
     840 * @param   pGCPhys     Where to store the GC physical address.
    841841 */
    842842PGMDECL(int) PGMPhysGCPtr2GCPhys(PVM pVM, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r4419 r4679  
    290290     * instruction and it either flushed the TLB or the CPU reused it.
    291291     */
    292     RTGCPHYS    GCPhys;
    293     RTGCUINTPTR offset;
    294 
    295     offset = (RTGCUINTPTR)GCSrc & PAGE_OFFSET_MASK;
    296 
     292    RTGCPHYS GCPhys;
    297293    rc = PGMPhysGCPtr2GCPhys(pVM, GCSrc, &GCPhys);
    298294    AssertRCReturn(rc, rc);
    299     PGMPhysRead(pVM, GCPhys + offset, pDest, cb);
     295    PGMPhysRead(pVM, GCPhys, pDest, cb);
    300296    return VINF_SUCCESS;
    301297#else
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r4665 r4679  
    830830 * @param   pVM         The VM Handle
    831831 * @param   GCPtr       The guest pointer to convert.
    832  * @param   pGCPhys     Where to store the HC physical address.
     832 * @param   pGCPhys     Where to store the GC physical address.
    833833 */
    834834PGMDECL(int) PGMPhysGCPtr2GCPhys(PVM pVM, RTGCPTR GCPtr, PRTGCPHYS pGCPhys)
    835835{
    836     return PGM_GST_PFN(GetPage,pVM)(pVM, (RTGCUINTPTR)GCPtr, NULL, pGCPhys);
     836    int rc = PGM_GST_PFN(GetPage,pVM)(pVM, (RTGCUINTPTR)GCPtr, NULL, pGCPhys);
     837    if (pGCPhys && VBOX_SUCCESS(rc))
     838        *pGCPhys |= (RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK;
     839    return rc;
    837840}
    838841
     
    19271930    {
    19281931        /* Convert virtual to physical address */
    1929         offset = GCPtrSrc & PAGE_OFFSET_MASK;
    19301932        rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrSrc, &GCPhys);
    19311933        AssertRCReturn(rc, rc);
     
    19351937        AssertRC(rc);
    19361938
    1937         PGMPhysRead(pVM, GCPhys + offset, pvDst, cb);
     1939        PGMPhysRead(pVM, GCPhys, pvDst, cb);
    19381940        return VINF_SUCCESS;
    19391941    }
     
    19451947    {
    19461948        /* Convert virtual to physical address */
    1947         offset = GCPtrSrc & PAGE_OFFSET_MASK;
    19481949        rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrSrc, &GCPhys);
    19491950        AssertRCReturn(rc, rc);
     
    19571958        if (cbRead >= cb)
    19581959        {
    1959             PGMPhysRead(pVM, GCPhys + offset, pvDst, cb);
     1960            PGMPhysRead(pVM, GCPhys, pvDst, cb);
    19601961            return VINF_SUCCESS;
    19611962        }
    1962         PGMPhysRead(pVM, GCPhys + offset, pvDst, cbRead);
     1963        PGMPhysRead(pVM, GCPhys, pvDst, cbRead);
    19631964
    19641965        /* next */
     
    20032004    {
    20042005        /* Convert virtual to physical address */
    2005         offset = GCPtrDst & PAGE_OFFSET_MASK;
    20062006        rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrDst, &GCPhys);
    20072007        AssertRCReturn(rc, rc);
     
    20112011        AssertRC(rc);
    20122012
    2013         PGMPhysWrite(pVM, GCPhys + offset, pvSrc, cb);
     2013        PGMPhysWrite(pVM, GCPhys, pvSrc, cb);
    20142014        return VINF_SUCCESS;
    20152015    }
     
    20212021    {
    20222022        /* Convert virtual to physical address */
    2023         offset = GCPtrDst & PAGE_OFFSET_MASK;
    20242023        rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrDst, &GCPhys);
    20252024        AssertRCReturn(rc, rc);
     
    20332032        if (cbWrite >= cb)
    20342033        {
    2035             PGMPhysWrite(pVM, GCPhys + offset, pvSrc, cb);
     2034            PGMPhysWrite(pVM, GCPhys, pvSrc, cb);
    20362035            return VINF_SUCCESS;
    20372036        }
    2038         PGMPhysWrite(pVM, GCPhys + offset, pvSrc, cbWrite);
     2037        PGMPhysWrite(pVM, GCPhys, pvSrc, cbWrite);
    20392038
    20402039        /* next */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette