VirtualBox

vbox的更動 11163 路徑 trunk/src/VBox/Devices/Graphics


忽略:
時間撮記:
2008-8-6 上午12:13:32 (16 年 以前)
作者:
vboxsync
訊息:

#1865: VGA. Changed PDMDevHlpMMHyperMapMMIO2/MMHyperMapMMIO2 to return a RC pointer instead of a GC one.

位置:
trunk/src/VBox/Devices/Graphics
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r10278 r11163  
    6666
    6767/** Converts a vga adaptor state pointer to a device instance pointer. */
    68 #define VGASTATE2DEVINS(pVgaState)    ((pVgaState)->CTXSUFF(pDevIns))
     68#define VGASTATE2DEVINS(pVgaState)    ((pVgaState)->CTX_SUFF(pDevIns))
    6969
    7070/** Use VBE bytewise I/O */
     
    937937                           s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset);
    938938#else /* VBOX */
    939                     memset(CTXSUFF(s->vram_ptr), 0,
     939                    memset(s->CTX_SUFF(vram_ptr), 0,
    940940                           s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset);
    941941#endif /* VBOX */
     
    10471047            else if (val == VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY)
    10481048            {
    1049                 s->pDrv->pfnProcessAdapterData(s->pDrv, s->CTXSUFF(vram_ptr), s->vram_size);
     1049                s->pDrv->pfnProcessAdapterData(s->pDrv, s->CTX_SUFF(vram_ptr), s->vram_size);
    10501050            }
    10511051            else if ((val & 0xFFFF0000) == VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE)
    10521052            {
    1053                 s->pDrv->pfnProcessDisplayData(s->pDrv, s->CTXSUFF(vram_ptr), val & 0xFFFF);
     1053                s->pDrv->pfnProcessDisplayData(s->pDrv, s->CTX_SUFF(vram_ptr), val & 0xFFFF);
    10541054            }
    10551055#endif /* IN_RING3 */
     
    11111111        ret = s->vram_ptr[addr];
    11121112#else /* VBOX */
    1113         ret = s->CTXSUFF(vram_ptr)[addr];
     1113        ret = s->CTX_SUFF(vram_ptr)[addr];
    11141114#endif /* VBOX */
    11151115    } else if (!(s->sr[4] & 0x04)) {    /* Host access is controlled by SR4, not GR5! */
     
    11201120#else /* VBOX */
    11211121        /* See the comment for a similar line in vga_mem_writeb. */
    1122         ret = s->CTXSUFF(vram_ptr)[((addr & ~1) << 2) | plane];
     1122        ret = s->CTX_SUFF(vram_ptr)[((addr & ~1) << 2) | plane];
    11231123#endif /* VBOX */
    11241124    } else {
     
    11271127        s->latch = ((uint32_t *)s->vram_ptr)[addr];
    11281128#else /* VBOX && IN_GC */
    1129         s->latch = ((uint32_t *)s->CTXSUFF(vram_ptr))[addr];
     1129        s->latch = ((uint32_t *)s->CTX_SUFF(vram_ptr))[addr];
    11301130#endif /* VBOX && IN_GC */
    11311131
     
    12361236            }
    12371237#endif
    1238             s->CTXSUFF(vram_ptr)[addr] = val;
     1238            s->CTX_SUFF(vram_ptr)[addr] = val;
    12391239#endif /* VBOX */
    12401240#ifdef DEBUG_VGA_MEM
     
    12771277            }
    12781278#endif
    1279             s->CTXSUFF(vram_ptr)[addr] = val;
     1279            s->CTX_SUFF(vram_ptr)[addr] = val;
    12801280#endif /* VBOX */
    12811281#ifdef DEBUG_VGA_MEM
     
    13711371            (val & write_mask);
    13721372#else /* VBOX */
    1373         ((uint32_t *)s->CTXSUFF(vram_ptr))[addr] =
    1374             (((uint32_t *)s->CTXSUFF(vram_ptr))[addr] & ~write_mask) |
     1373        ((uint32_t *)s->CTX_SUFF(vram_ptr))[addr] =
     1374            (((uint32_t *)s->CTX_SUFF(vram_ptr))[addr] & ~write_mask) |
    13751375            (val & write_mask);
    13761376#endif /* VBOX */
     
    16991699    font_base[0] = s->vram_ptr + offset;
    17001700#else /* VBOX */
    1701     font_base[0] = s->CTXSUFF(vram_ptr) + offset;
     1701    font_base[0] = s->CTX_SUFF(vram_ptr) + offset;
    17021702#endif /* VBOX */
    17031703
     
    17061706    font_base[1] = s->vram_ptr + offset;
    17071707#else /* VBOX */
    1708     font_base[1] = s->CTXSUFF(vram_ptr) + offset;
     1708    font_base[1] = s->CTX_SUFF(vram_ptr) + offset;
    17091709#endif /* VBOX */
    17101710    if (offset != s->font_offsets[1]) {
     
    17241724    s1 = s->vram_ptr + (s->start_addr * 4);
    17251725#else /* VBOX */
    1726     s1 = s->CTXSUFF(vram_ptr) + (s->start_addr * 8);
     1726    s1 = s->CTX_SUFF(vram_ptr) + (s->start_addr * 8);
    17271727#endif /* VBOX */
    17281728
     
    18011801    depth_index = get_depth_index(s->ds->depth);
    18021802#else /* VBOX */
    1803     cursor_ptr = s->CTXSUFF(vram_ptr) + (s->start_addr + cursor_offset) * 8;
     1803    cursor_ptr = s->CTX_SUFF(vram_ptr) + (s->start_addr + cursor_offset) * 8;
    18041804    depth_index = get_depth_index(s->pDrv->cBits);
    18051805#endif /* VBOX */
     
    20332033    /** @todo r=sunlover: If the guest changes VBE_DISPI_INDEX_X_OFFSET, VBE_DISPI_INDEX_Y_OFFSET
    20342034     *                    registers, then the third parameter of the following call should be
    2035      *                    probably 's->CTXSUFF(vram_ptr) + s->vbe_start_addr'.
     2035     *                    probably 's->CTX_SUFF(vram_ptr) + s->vbe_start_addr'.
    20362036     */
    2037     int rc = s->pDrv->pfnResize(s->pDrv, cBits, s->CTXSUFF(vram_ptr), s->line_offset, cx, cy);
     2037    int rc = s->pDrv->pfnResize(s->pDrv, cBits, s->CTX_SUFF(vram_ptr), s->line_offset, cx, cy);
    20382038
    20392039    /* last stuff */
     
    22422242#else /* VBOX */
    22432243            if (s->fRenderVRAM)
    2244                 vga_draw_line(s, d, s->CTXSUFF(vram_ptr) + addr, width);
     2244                vga_draw_line(s, d, s->CTX_SUFF(vram_ptr) + addr, width);
    22452245#endif /* VBOX */
    22462246            if (s->cursor_draw_line)
     
    23282328    uint32_t cbScanline = s->pDrv->cbScanline;
    23292329
    2330     if (s->pDrv->pu8Data == s->vram_ptrHC) /* Do not clear the VRAM itself. */
     2330    if (s->pDrv->pu8Data == s->vram_ptrR3) /* Do not clear the VRAM itself. */
    23312331        return;
    23322332    if (!full_update)
     
    32653265                if (pData->sr[2] & (1 << (GCPhysAddr & 3)))
    32663266                {
    3267                     CTXSUFF(pData->vram_ptr)[GCPhysAddr] = aVal[i];
     3267                    pData->CTX_SUFF(vram_ptr)[GCPhysAddr] = aVal[i];
    32683268                    vga_set_dirty(pData, GCPhysAddr);
    32693269                }
     
    32883288                if (pData->sr[2] & (1 << plane)) {
    32893289                    RTGCPHYS PhysAddr2 = ((GCPhysAddr & ~1) << 2) | plane;
    3290                     CTXSUFF(pData->vram_ptr)[PhysAddr2] = aVal[i];
     3290                    pData->CTX_SUFF(vram_ptr)[PhysAddr2] = aVal[i];
    32913291                    vga_set_dirty(pData, PhysAddr2);
    32923292                }
     
    33693369            while (cItems-- > 0)
    33703370            {
    3371                 ((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask);
     3371                ((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask);
    33723372                vga_set_dirty(pData, GCPhysAddr << 2);
    33733373                GCPhysAddr++;
     
    33793379            while (cItems-- > 0)
    33803380            {
    3381                 ((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask);
     3381                ((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask);
    33823382                vga_set_dirty(pData, GCPhysAddr << 2);
    33833383                GCPhysAddr++;
    33843384
    3385                 ((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[1] & write_mask);
     3385                ((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[1] & write_mask);
    33863386                vga_set_dirty(pData, GCPhysAddr << 2);
    33873387                GCPhysAddr++;
     
    33953395                for (i = 0; i < cbItem; i++)
    33963396                {
    3397                     ((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTXSUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[i] & write_mask);
     3397                    ((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pData->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[i] & write_mask);
    33983398                    vga_set_dirty(pData, GCPhysAddr << 2);
    33993399                    GCPhysAddr++;
     
    40504050
    40514051                if (pData->vram_size >= LOGO_MAX_SIZE * 2)
    4052                     pu8Dst = pData->vram_ptrHC + LOGO_MAX_SIZE;
     4052                    pu8Dst = pData->vram_ptrR3 + LOGO_MAX_SIZE;
    40534053                else
    4054                     pu8Dst = pData->vram_ptrHC;
     4054                    pu8Dst = pData->vram_ptrR3;
    40554055
    40564056                /* Clear screen - except on power on... */
     
    40844084                if (pData->vram_size >= LOGO_MAX_SIZE * 2)
    40854085                {
    4086                     uint32_t *pu32TmpDst = (uint32_t *)pData->vram_ptrHC;
    4087                     uint32_t *pu32TmpSrc = (uint32_t *)(pData->vram_ptrHC + LOGO_MAX_SIZE);
     4086                    uint32_t *pu32TmpDst = (uint32_t *)pData->vram_ptrR3;
     4087                    uint32_t *pu32TmpSrc = (uint32_t *)(pData->vram_ptrR3 + LOGO_MAX_SIZE);
    40884088                    for (int i = 0; i < LOGO_MAX_WIDTH; i++)
    40894089                    {
     
    43384338    if (pData->fHaveDirtyBits && pData->GCPhysVRAM && pData->GCPhysVRAM != NIL_RTGCPHYS32)
    43394339    {
    4340         PPDMDEVINS pDevIns = pData->pDevInsHC;
     4340        PPDMDEVINS pDevIns = pData->CTX_SUFF(pDevIns);
    43414341        PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pData->GCPhysVRAM);
    43424342        pData->fHaveDirtyBits = false;
     
    43714371    if (pData->GCPhysVRAM && pData->GCPhysVRAM != NIL_RTGCPHYS32)
    43724372    {
    4373         PPDMDEVINS pDevIns = pData->pDevInsHC;
     4373        PPDMDEVINS pDevIns = pData->CTX_SUFF(pDevIns);
    43744374        PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pData->GCPhysVRAM);
    43754375    }
     
    47174717     * This is true because coordinates were verified.
    47184718     */
    4719     pu8Src = s->vram_ptrHC;
     4719    pu8Src = s->vram_ptrR3;
    47204720    pu8Src += u32OffsetSrc + y * cbLineSrc + x * cbPixelSrc;
    47214721
     
    48634863
    48644864    /* Clear the VRAM ourselves. */
    4865     if (pData->vram_ptrHC && pData->vram_size)
     4865    if (pData->vram_ptrR3 && pData->vram_size)
    48664866    {
    48674867#ifdef LOG_ENABLED /** @todo separate function. */
     
    48854885
    48864886            line_offset = s->line_offset;
    4887             s1 = s->CTXSUFF(vram_ptr) + (s->start_addr * 4);
     4887            s1 = s->CTX_SUFF(vram_ptr) + (s->start_addr * 4);
    48884888
    48894889            /* total width & height */
     
    49404940
    49414941#endif /* LOG_ENABLED */
    4942         memset(pData->vram_ptrHC, 0, pData->vram_size);
     4942        memset(pData->vram_ptrR3, 0, pData->vram_size);
    49434943    }
    49444944
     
    49464946     * Zero most of it.
    49474947     *
    4948      * Unlike vga_reset we're leaving out a few members which believe must
    4949      * remain unchanged....
     4948     * Unlike vga_reset we're leaving out a few members which we believe
     4949     * must remain unchanged....
    49504950     */
    49514951    /* 1st part. */
     
    50135013        LogFlow(("vgaRelocate: offDelta = %08X\n", offDelta));
    50145014
    5015         pData->GCPtrLFBHandler += offDelta;
    5016         pData->vram_ptrGC += offDelta;
     5015        pData->RCPtrLFBHandler += offDelta;
     5016        pData->vram_ptrRC += offDelta;
     5017        pData->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    50175018    }
    50185019}
     
    51335134static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
    51345135{
    5135     static bool fExpandDone = false;
     5136    static bool s_fExpandDone = false;
    51365137    bool        f;
    51375138    int         rc;
     
    51525153     * Init static data.
    51535154     */
    5154     if (!fExpandDone)
    5155     {
    5156         fExpandDone = true;
     5155    if (!s_fExpandDone)
     5156    {
     5157        s_fExpandDone = true;
    51575158        vga_init_expand();
    51585159    }
     
    52205221    Log(("VGA: fR0Enabled=%d\n", pData->fR0Enabled));
    52215222
    5222     pData->pDevInsHC = pDevIns;
     5223    pData->pDevInsR3 = pDevIns;
     5224    pData->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     5225    pData->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    52235226
    52245227    vgaR3Reset(pDevIns);
     
    52365239
    52375240    /* The LBF access handler - error handling is better here than in the map function.  */
    5238     rc = PDMR3GetSymbolGCLazy(pVM, pDevIns->pDevReg->szGCMod, "vgaGCLFBAccessHandler", &pData->GCPtrLFBHandler);
     5241    rc = PDMR3GetSymbolGCLazy(pVM, pDevIns->pDevReg->szGCMod, "vgaGCLFBAccessHandler", &pData->RCPtrLFBHandler);
    52395242    if (VBOX_FAILURE(rc))
    52405243    {
     
    52595262     * Allocate the VRAM and map the first 256KB of it into GC so we can speed up VGA support.
    52605263     */
    5261     rc = PDMDevHlpMMIO2Register(pDevIns, 0 /* iRegion */, pData->vram_size, 0, (void **)&pData->vram_ptrHC, "VRam");
     5264    rc = PDMDevHlpMMIO2Register(pDevIns, 0 /* iRegion */, pData->vram_size, 0, (void **)&pData->vram_ptrR3, "VRam");
    52625265    AssertMsgRC(rc, ("PDMDevHlpMMIO2Register(%#x,) -> %Rrc\n", pData->vram_size, rc));
    5263 
    5264     RTGCPTR pGCMapping = 0;
    5265     rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, 0 /* iRegion */, 0 /* off */,  VGA_MAPPING_SIZE, "VGA VRam", &pGCMapping);
     5266    pData->vram_ptrR0 = (RTR0PTR)pData->vram_ptrR3; /** @todo #1865 Map parts into R0 or just use PGM access (Mac only). */
     5267
     5268    RTRCPTR pRCMapping = 0;
     5269    rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, 0 /* iRegion */, 0 /* off */,  VGA_MAPPING_SIZE, "VGA VRam", &pRCMapping);
    52665270    AssertMsgRC(rc, ("MMR3HyperMapGCPhys(%#x,) -> %Rrc\n", pData->vram_size, rc));
    5267 #if GC_ARCH_BITS == 64
    5268     Assert(!(pGCMapping >> 32ULL));
    5269 #endif
    5270     pData->vram_ptrGC = pGCMapping;
     5271    pData->vram_ptrRC = pRCMapping;
    52715272
    52725273    /*
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r9212 r11163  
    187187         some type changes, and some padding have been added. */
    188188#define VGA_STATE_COMMON                                                \
    189     R3R0PTRTYPE(uint8_t *) vram_ptrHC;                                  \
     189    R3PTRTYPE(uint8_t *) vram_ptrR3;                                    \
    190190    uint32_t vram_size;                                                 \
    191191    uint32_t latch;                                                     \
     
    250250    /** The physical address the VRAM was assigned. */
    251251    RTGCPHYS32                  GCPhysVRAM;
    252     /** Pointer to GC vram mapping. */
    253     RCPTRTYPE(uint8_t *)        vram_ptrGC;
    254 /** @todo r=bird: bool not RTUINT (my fault I guess). */
     252    /** The R0 vram pointer... */
     253    R0PTRTYPE(uint8_t *)        vram_ptrR0;
     254    /** Pointer to the GC vram mapping. */
     255    RCPTRTYPE(uint8_t *)        vram_ptrRC;
    255256    /** LFB was updated flag. */
    256     RTUINT                      fLFBUpdated;
     257    bool                        fLFBUpdated;
    257258    /** Indicates if the GC extensions are enabled or not. */
    258     RTUINT                      fGCEnabled;
     259    bool                        fGCEnabled;
    259260    /** Indicates if the R0 extensions are enabled or not. */
    260     RTUINT                      fR0Enabled;
    261     /** Pointer to vgaGCLFBAccessHandler(). */
    262     RTGCPTR32                   GCPtrLFBHandler;
     261    bool                        fR0Enabled;
    263262    /** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */
    264263    bool                        fHaveDirtyBits;
     264    /** Pointer to vgaGCLFBAccessHandler(). */
     265    RTRCPTR                     RCPtrLFBHandler;
    265266    /** Bitmap tracking dirty pages. */
    266267    uint32_t                    au32DirtyBitmap[VGA_VRAM_MAX / PAGE_SIZE / 32];
    267     /** Pointer to the device instance - HC Ptr. */
    268     R3R0PTRTYPE(PPDMDEVINS)     pDevInsHC;
    269     /* * Pointer to the device instance - GC Ptr. */
    270     /*RCPTRTYPE(PPDMDEVINS)   pDevInsGC;*/
     268    /** Pointer to the device instance - RC Ptr. */
     269    PPDMDEVINSRC                pDevInsRC;
     270    /** Pointer to the device instance - R3 Ptr. */
     271    PPDMDEVINSR3                pDevInsR3;
     272    /** Pointer to the device instance - R0 Ptr. */
     273    PPDMDEVINSR0                pDevInsR0;
    271274
    272275    /** The display port base interface. */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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