VirtualBox

Changeset 97697 in vbox


Ignore:
Timestamp:
Nov 29, 2022 7:02:14 AM (2 years ago)
Author:
vboxsync
Message:

Devices/Graphics: removed unused code. bugref:9830

Location:
trunk/src/VBox/Devices/Graphics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp

    r96407 r97697  
    356356 */
    357357
    358 /**
    359  * HC access handler for GBOs which require write protection, i.e. OTables, etc.
    360  *
    361  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
    362  * @param   pVM             VM Handle.
    363  * @param   pVCpu           The cross context CPU structure for the calling EMT.
    364  * @param   GCPhys          The physical address the guest is writing to.
    365  * @param   pvPhys          The HC mapping of that address.
    366  * @param   pvBuf           What the guest is reading/writing.
    367  * @param   cbBuf           How much it's reading/writing.
    368  * @param   enmAccessType   The access type.
    369  * @param   enmOrigin       Who is making the access.
    370  * @param   uUser           The VMM automatically sets this to the address of
    371  *                          the device instance.
    372  */
    373 DECLCALLBACK(VBOXSTRICTRC)
    374 vmsvgaR3GboAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    375                          PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
    376 {
    377     RT_NOREF(pVM, pVCpu, pvPhys, enmAccessType);
    378 
    379     if (RT_LIKELY(enmOrigin == PGMACCESSORIGIN_DEVICE || enmOrigin == PGMACCESSORIGIN_DEBUGGER))
    380         return VINF_PGM_HANDLER_DO_DEFAULT;
    381 
    382     PPDMDEVINS      pDevIns = (PPDMDEVINS)uUser;
    383     AssertPtrReturn(pDevIns, VERR_INTERNAL_ERROR_4);
    384     AssertReturn(pDevIns->u32Version == PDM_DEVINSR3_VERSION, VERR_INTERNAL_ERROR_5);
    385     PVGASTATE       pThis   = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
    386     PVGASTATECC     pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC);
    387     PVMSVGAR3STATE  pSvgaR3State = pThisCC->svga.pSvgaR3State;
    388 
    389     /*
    390      * The guest is not allowed to access the memory.
    391      * Set the error condition.
    392      */
    393     ASMAtomicWriteBool(&pThis->svga.fBadGuest, true);
    394 
    395     /* Try to find the GBO which the guest is accessing. */
    396     char const *pszTarget = NULL;
    397     for (uint32_t i = 0; i < RT_ELEMENTS(pSvgaR3State->aGboOTables) && !pszTarget; ++i)
    398     {
    399         PVMSVGAGBO pGbo = &pSvgaR3State->aGboOTables[i];
    400         if (pGbo->cDescriptors)
    401         {
    402             for (uint32_t j = 0; j < pGbo->cDescriptors; ++j)
    403             {
    404                 if (   GCPhys >= pGbo->paDescriptors[j].GCPhys
    405                     && GCPhys < pGbo->paDescriptors[j].GCPhys + pGbo->paDescriptors[j].cPages * GUEST_PAGE_SIZE)
    406                 {
    407                     switch (i)
    408                     {
    409                         case SVGA_OTABLE_MOB:          pszTarget = "SVGA_OTABLE_MOB";          break;
    410                         case SVGA_OTABLE_SURFACE:      pszTarget = "SVGA_OTABLE_SURFACE";      break;
    411                         case SVGA_OTABLE_CONTEXT:      pszTarget = "SVGA_OTABLE_CONTEXT";      break;
    412                         case SVGA_OTABLE_SHADER:       pszTarget = "SVGA_OTABLE_SHADER";       break;
    413                         case SVGA_OTABLE_SCREENTARGET: pszTarget = "SVGA_OTABLE_SCREENTARGET"; break;
    414                         case SVGA_OTABLE_DXCONTEXT:    pszTarget = "SVGA_OTABLE_DXCONTEXT";    break;
    415                         default:                       pszTarget = "Unknown OTABLE";           break;
    416                     }
    417                     break;
    418                 }
    419             }
    420         }
    421     }
    422 
    423     LogRelMax(8, ("VMSVGA: invalid guest access to page %RGp, target %s:\n"
    424                   "%.*Rhxd\n",
    425                   GCPhys, pszTarget ? pszTarget : "unknown", RT_MIN(cbBuf, 256), pvBuf));
    426 
    427     return VINF_PGM_HANDLER_DO_DEFAULT;
    428 }
    429 
    430358#ifdef VBOX_WITH_VMSVGA3D
    431359
    432 static int vmsvgaR3GboCreate(PVMSVGAR3STATE pSvgaR3State, SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, bool fWriteProtected, PVMSVGAGBO pGbo)
     360static int vmsvgaR3GboCreate(PVMSVGAR3STATE pSvgaR3State, SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, PVMSVGAGBO pGbo)
    433361{
    434362    ASSERT_GUEST_RETURN(sizeInBytes <= _128M, VERR_INVALID_PARAMETER); /** @todo Less than SVGA_REG_MOB_MAX_SIZE */
     
    598526        pGbo->paDescriptors = paDescriptors;
    599527
    600 #if 1 /// @todo PGMHandlerPhysicalRegister asserts deep in PGM code with enmKind of a page being out of range.
    601 fWriteProtected = false;
    602 #endif
    603     if (fWriteProtected)
    604     {
    605         pGbo->fGboFlags |= VMSVGAGBO_F_WRITE_PROTECTED;
    606         for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
    607         {
    608             rc = PDMDevHlpPGMHandlerPhysicalRegister(pSvgaR3State->pDevIns,
    609                                                      pGbo->paDescriptors[i].GCPhys,
    610                                                        pGbo->paDescriptors[i].GCPhys
    611                                                      + pGbo->paDescriptors[i].cPages * GUEST_PAGE_SIZE - 1,
    612                                                      pSvgaR3State->hGboAccessHandlerType, "VMSVGA GBO");
    613             AssertRC(rc);
    614         }
    615     }
     528    pGbo->fGboFlags = 0;
     529    pGbo->pvHost = NULL;
    616530
    617531    return VINF_SUCCESS;
     
    621535static void vmsvgaR3GboDestroy(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
    622536{
     537    RT_NOREF(pSvgaR3State);
     538
    623539    if (RT_LIKELY(VMSVGA_IS_GBO_CREATED(pGbo)))
    624540    {
    625         if (pGbo->fGboFlags & VMSVGAGBO_F_WRITE_PROTECTED)
    626         {
    627             for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
    628             {
    629                 int rc = PDMDevHlpPGMHandlerPhysicalDeregister(pSvgaR3State->pDevIns, pGbo->paDescriptors[i].GCPhys);
    630                 AssertRC(rc);
    631             }
    632         }
    633541        RTMemFree(pGbo->paDescriptors);
    634         RT_ZERO(pGbo);
     542        RT_ZERO(*pGbo);
    635543    }
    636544}
     
    821729        /* Create a new guest backed object for the object table. */
    822730        VMSVGAGBO gbo;
    823         int rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, /* fWriteProtected = */ true, &gbo);
     731        int rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, &gbo);
    824732        AssertRCReturn(rc, rc);
    825733
     734        /* If the guest sets a new OTable (fGrow == false), then it has already copied the valid data to the new GBO. */
    826735        if (fGrow && validSizeInBytes)
    827736        {
     
    915824    {
    916825        /* Create the corresponding GBO. */
    917         rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, /* fWriteProtected = */ false, &pMob->Gbo);
     826        rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, &pMob->Gbo);
    918827        if (RT_SUCCESS(rc))
    919828        {
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-internal.h

    r96407 r97697  
    140140    RTCRITSECT              CritSectCmdBuf;
    141141
    142     /** Write protected GBOs (OTables) access handler type handle. */
    143     PGMPHYSHANDLERTYPE      hGboAccessHandlerType;
    144 
    145     /**  */
     142    /** Object Tables: MOBs, etc. see SVGA_OTABLE_* */
    146143    VMSVGAGBO               aGboOTables[SVGA_OTABLE_MAX];
    147144
     
    262259#endif
    263260
    264 DECLCALLBACK(VBOXSTRICTRC) vmsvgaR3GboAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
    265                                                     PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser);
    266 
    267261void vmsvgaR3ResetScreens(PVGASTATE pThis, PVGASTATECC pThisCC);
    268262
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r96950 r97697  
    66186618    pSVGAState = pThisCC->svga.pSvgaR3State;
    66196619
    6620     /* Register the write-protected GBO access handler type (no ring-0 callbacks here). */
    6621     rc = PDMDevHlpPGMHandlerPhysicalTypeRegister(pDevIns, PGMPHYSHANDLERKIND_WRITE, vmsvgaR3GboAccessHandler,
    6622                                                  "VMSVGA GBO", &pSVGAState->hGboAccessHandlerType);
    6623     AssertRCReturn(rc, rc);
    6624 
    66256620    /* VRAM tracking is enabled by default during bootup. */
    66266621    pThis->svga.fVRAMTracking = true;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h

    r96407 r97697  
    621621typedef VMSVGAGBO const *PCVMSVGAGBO;
    622622
    623 #define VMSVGAGBO_F_WRITE_PROTECTED 0x1
     623#define VMSVGAGBO_F_OBSOLETE_0x1    0x1
    624624#define VMSVGAGBO_F_HOST_BACKED     0x2
    625625
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