VirtualBox

Changeset 105751 in vbox


Ignore:
Timestamp:
Aug 21, 2024 9:51:08 AM (5 weeks ago)
Author:
vboxsync
Message:

VMMDev,Vbgl: Extend the VMMDevReq_HGCMCancel2 request to take a full 64-bit physical address. This should be backwards compatible. bugref:10456

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VMMDev.h

    r100185 r105751  
    17631763
    17641764/**
    1765  * HGCM cancel request structure, version 2.
     1765 * HGCM cancel request structure, version 2/old.
    17661766 *
    17671767 * Used by VMMDevReq_HGCMCancel2.
     
    17771777    /** The physical address of the request to cancel. */
    17781778    RTGCPHYS32 physReqToCancel;
     1779} VMMDevHGCMCancel2Old;
     1780AssertCompileSize(VMMDevHGCMCancel2Old, 24+4);
     1781
     1782/**
     1783 * HGCM cancel request structure, version 2 w/ 64-bit address.
     1784 *
     1785 * Used by VMMDevReq_HGCMCancel2.
     1786 *
     1787 * VINF_SUCCESS when cancelled.
     1788 * VERR_NOT_FOUND if the specified request cannot be found.
     1789 * VERR_INVALID_PARAMETER if the address is invalid valid.
     1790 *
     1791 * @note  For little endian guests, this is backwards compatible with
     1792 *        VMMDevHGCMCancel2Old since the hosts prior to 7.1 only checked for a
     1793 *        minimum sizeof(VMMDevHGCMCancel2Old) and would ignore any additional
     1794 *        bytes in the request.  Growing physReqToCancel to 64-bit makes use of
     1795 *        this, though the host code now require either the exactly old size or
     1796 *        a minimum size of this amended structure.
     1797 * @since VBox 7.1
     1798 */
     1799typedef struct
     1800{
     1801    /** Header. */
     1802    VMMDevRequestHeader header;
     1803    /** The physical address of the request to cancel. */
     1804    RTGCPHYS physReqToCancel;
    17791805} VMMDevHGCMCancel2;
    1780 AssertCompileSize(VMMDevHGCMCancel2, 24+4);
     1806AssertCompileSize(VMMDevHGCMCancel2, 24+8);
    17811807
    17821808#endif /* VBOX_WITH_HGCM */
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibHGCMInternal.cpp

    r98103 r105751  
    733733             *
    734734             * This is a bit messy because we're racing request completion. Sorry.
     735             *
     736             * Note! The VMMDevHGCMCancel2 request size was increased in 7.1 to fully
     737             *       handle 64-bit addresses.  Using the new structure size with older
     738             *       VBox host versions will work, though, since they check for a
     739             *       minimum request size and will ignore any extra stuff they don't
     740             *       understand.  Both ARM and x86 guests are little endian, this
     741             *       naturally wouldn't work for big-endian guests.
     742             *
     743             *       Of course, they won't find requests with addresses above 4GB, but
     744             *       that's not a real issue since it is used by ARM guests only.
    735745             */
    736746            /** @todo It would be nice if we could use the waiter callback to do further
     
    745755                VbglR0GRFree(&pCancelReq->header);
    746756            }
    747 #if 1 /** @todo ADDVER: Remove this on next minor version change. */
    748             if (rc2 == VERR_NOT_IMPLEMENTED)
    749             {
    750                 /* host is too old, or we're out of heap. */
    751                 pHGCMCall->header.fu32Flags |= VBOX_HGCM_REQ_CANCELLED;
    752                 pHGCMCall->header.header.requestType = VMMDevReq_HGCMCancel;
    753                 rc2 = VbglR0GRPerform(&pHGCMCall->header.header);
    754                 if (rc2 == VERR_INVALID_PARAMETER)
    755                     rc2 = VERR_NOT_FOUND;
    756                 else if (RT_SUCCESS(rc))
    757                     RTThreadSleep(1);
    758             }
    759 #endif
    760757            if (RT_SUCCESS(rc)) rc = VERR_INTERRUPTED; /** @todo weed this out from the WINNT VBoxGuest code. */
    761758            if (RT_SUCCESS(rc2))
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r104065 r105751  
    20012001static int vmmdevReqHandler_HGCMCancel2(PVMMDEVCC pThisCC, VMMDevRequestHeader *pReqHdr)
    20022002{
    2003     VMMDevHGCMCancel2 *pReq = (VMMDevHGCMCancel2 *)pReqHdr;
    2004     AssertMsgReturn(pReq->header.size >= sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);  /** @todo Not sure why this >= ... */
     2003    /* Note! Using '>=' for the size check because that simplifies amending the
     2004             structure (like we did already) */
     2005    RTGCPHYS GCPhysReqToCancel;
     2006    if (pReqHdr->size >= sizeof(VMMDevHGCMCancel2))
     2007        GCPhysReqToCancel = ((VMMDevHGCMCancel2 const *)pReqHdr)->physReqToCancel;
     2008    else if (pReqHdr->size == sizeof(VMMDevHGCMCancel2Old))
     2009        GCPhysReqToCancel = ((VMMDevHGCMCancel2Old const *)pReqHdr)->physReqToCancel;
     2010    else
     2011        AssertMsgFailedReturn(("%u\n", pReqHdr->size), VERR_INVALID_PARAMETER);
     2012    RT_UNTRUSTED_VALIDATED_FENCE();
    20052013
    20062014    if (pThisCC->pHGCMDrv)
    20072015    {
    2008         Log(("VMMDevReq_HGCMCancel2\n"));
    2009         return vmmdevR3HgcmCancel2(pThisCC, pReq->physReqToCancel);
     2016        Log(("VMMDevReq_HGCMCancel2: %RGp\n", GCPhysReqToCancel));
     2017        return vmmdevR3HgcmCancel2(pThisCC, GCPhysReqToCancel);
    20102018    }
    20112019
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