VirtualBox

Ignore:
Timestamp:
Oct 9, 2015 6:02:55 PM (9 years ago)
Author:
vboxsync
Message:

VMMDev: More positive thinking, a couple of extra sanity checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r58159 r58160  
    608608     */
    609609    AssertCompile(sizeof(pThis->guestInfo2.szName) == sizeof(pInfo2->szName));
    610     AssertReturn(memchr(pInfo2->szName, '\0', sizeof(pInfo2->szName)) != NULL, VERR_INVALID_PARAMETER);
     610    AssertReturn(RTStrEnd(pInfo2->szName, sizeof(pInfo2->szName)) != NULL, VERR_INVALID_PARAMETER);
    611611    const char *pszName = pInfo2->szName;
    612612
     
    670670
    671671    /* Clear our IRQ in case it was high for whatever reason. */
    672     PDMDevHlpPCISetIrqNoWait (pThis->pDevIns, 0, 0);
     672    PDMDevHlpPCISetIrqNoWait(pThis->pDevIns, 0, 0);
    673673
    674674    return VINF_SUCCESS;
     
    10501050    }
    10511051
    1052     bool fVisible = (pReq->fFlags & VBOX_MOUSE_POINTER_VISIBLE) != 0;
    1053     bool fAlpha = (pReq->fFlags & VBOX_MOUSE_POINTER_ALPHA) != 0;
    1054     bool fShape = (pReq->fFlags & VBOX_MOUSE_POINTER_SHAPE) != 0;
     1052    bool fVisible = RT_BOOL(pReq->fFlags & VBOX_MOUSE_POINTER_VISIBLE);
     1053    bool fAlpha   = RT_BOOL(pReq->fFlags & VBOX_MOUSE_POINTER_ALPHA);
     1054    bool fShape   = RT_BOOL(pReq->fFlags & VBOX_MOUSE_POINTER_SHAPE);
    10551055
    10561056    Log(("VMMDevReq_SetPointerShape: visible: %d, alpha: %d, shape = %d, width: %d, height: %d\n",
     
    11041104    AssertMsgReturn(pReq->header.size == sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);
    11051105
    1106     if (RT_UNLIKELY(pThis->fGetHostTimeDisabled))
    1107         return VERR_NOT_SUPPORTED;
    1108 
    1109     RTTIMESPEC now;
    1110     pReq->time = RTTimeSpecGetMilli(PDMDevHlpTMUtcNow(pThis->pDevIns, &now));
    1111     return VINF_SUCCESS;
     1106    if (RT_LIKELY(!pThis->fGetHostTimeDisabled))
     1107    {
     1108        RTTIMESPEC now;
     1109        pReq->time = RTTimeSpecGetMilli(PDMDevHlpTMUtcNow(pThis->pDevIns, &now));
     1110        return VINF_SUCCESS;
     1111    }
     1112    return VERR_NOT_SUPPORTED;
    11121113}
    11131114
     
    11541155            /* new reservation */
    11551156            rc = PGMR3MappingsFix(pVM, pReq->hypervisorStart, pReq->hypervisorSize);
    1156             LogRel(("VMMDev: Guest reported fixed hypervisor window at 0%010x (size = %#x, rc = %Rrc)\n", pReq->hypervisorStart,
    1157                     pReq->hypervisorSize, rc));
     1157            LogRel(("VMMDev: Guest reported fixed hypervisor window at 0%010x LB %#x (rc=%Rrc)\n",
     1158                    pReq->hypervisorStart, pReq->hypervisorSize, rc));
    11581159        }
    11591160        else if (RT_FAILURE(rc))
     
    12551256/**
    12561257 * @todo It looks like a multi-monitor guest which only uses
    1257  *        @a VMMDevReq_GetDisplayChangeRequest (not the *2 version)
    1258  *        will get into a @a VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST event
    1259  *        loop if it tries to acknowlege host requests for additional
    1260  *        monitors.  Should the loop which checks for those requests
    1261  *        be removed?
     1258 *        @c VMMDevReq_GetDisplayChangeRequest (not the *2 version) will get
     1259 *        into a @c VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST event loop if it tries
     1260 *        to acknowlege host requests for additional monitors.  Should the loop
     1261 *        which checks for those requests be removed?
    12621262 */
    12631263
     
    15721572    AssertMsgReturn(pReq->header.size == sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);
    15731573
    1574     if (VMMDEV_INTERFACE_VERSION_IS_1_03(pThis))
    1575     {
    1576         vmmdevSetIRQ_Legacy(pThis);
    1577     }
    1578     else
     1574    if (!VMMDEV_INTERFACE_VERSION_IS_1_03(pThis))
    15791575    {
    15801576        if (pThis->fNewGuestFilterMask)
     
    15901586        PDMDevHlpPCISetIrqNoWait(pThis->pDevIns, 0, 0);
    15911587    }
     1588    else
     1589        vmmdevSetIRQ_Legacy(pThis);
    15921590    return VINF_SUCCESS;
    15931591}
     
    16301628    AssertMsgReturn(pReq->header.header.size >= sizeof(*pReq), ("%u\n", pReq->header.header.size), VERR_INVALID_PARAMETER); /** @todo Not sure why this is >= ... */
    16311629
    1632     if (!pThis->pHGCMDrv)
    1633     {
    1634         Log(("VMMDevReq_HGCMConnect: HGCM Connector is NULL!\n"));
    1635         return VERR_NOT_SUPPORTED;
    1636     }
    1637 
    1638     Log(("VMMDevReq_HGCMConnect\n"));
    1639     return vmmdevHGCMConnect(pThis, pReq, GCPhysReqHdr);
     1630    if (pThis->pHGCMDrv)
     1631    {
     1632        Log(("VMMDevReq_HGCMConnect\n"));
     1633        return vmmdevHGCMConnect(pThis, pReq, GCPhysReqHdr);
     1634    }
     1635
     1636    Log(("VMMDevReq_HGCMConnect: HGCM Connector is NULL!\n"));
     1637    return VERR_NOT_SUPPORTED;
    16401638}
    16411639
     
    16541652    AssertMsgReturn(pReq->header.header.size >= sizeof(*pReq), ("%u\n", pReq->header.header.size), VERR_INVALID_PARAMETER);  /** @todo Not sure why this >= ... */
    16551653
    1656     if (!pThis->pHGCMDrv)
    1657     {
    1658         Log(("VMMDevReq_VMMDevHGCMDisconnect: HGCM Connector is NULL!\n"));
    1659         return VERR_NOT_SUPPORTED;
    1660     }
    1661 
    1662     Log(("VMMDevReq_VMMDevHGCMDisconnect\n"));
    1663     return vmmdevHGCMDisconnect(pThis, pReq, GCPhysReqHdr);
     1654    if (pThis->pHGCMDrv)
     1655    {
     1656        Log(("VMMDevReq_VMMDevHGCMDisconnect\n"));
     1657        return vmmdevHGCMDisconnect(pThis, pReq, GCPhysReqHdr);
     1658    }
     1659
     1660    Log(("VMMDevReq_VMMDevHGCMDisconnect: HGCM Connector is NULL!\n"));
     1661    return VERR_NOT_SUPPORTED;
    16641662}
    16651663
     
    16781676    AssertMsgReturn(pReq->header.header.size >= sizeof(*pReq), ("%u\n", pReq->header.header.size), VERR_INVALID_PARAMETER);
    16791677
    1680     if (!pThis->pHGCMDrv)
    1681     {
    1682         Log(("VMMDevReq_HGCMCall: HGCM Connector is NULL!\n"));
    1683         return VERR_NOT_SUPPORTED;
    1684     }
    1685 
    1686     Log2(("VMMDevReq_HGCMCall: sizeof(VMMDevHGCMRequest) = %04X\n", sizeof(VMMDevHGCMCall)));
    1687     Log2(("%.*Rhxd\n", pReq->header.header.size, pReq));
     1678    if (pThis->pHGCMDrv)
     1679    {
     1680        Log2(("VMMDevReq_HGCMCall: sizeof(VMMDevHGCMRequest) = %04X\n", sizeof(VMMDevHGCMCall)));
     1681        Log2(("%.*Rhxd\n", pReq->header.header.size, pReq));
    16881682
    16891683#ifdef VBOX_WITH_64_BITS_GUESTS
    1690     bool f64Bits = (pReq->header.header.requestType == VMMDevReq_HGCMCall64);
     1684        bool f64Bits = (pReq->header.header.requestType == VMMDevReq_HGCMCall64);
    16911685#else
    1692     bool f64Bits = false;
     1686        bool f64Bits = false;
    16931687#endif /* VBOX_WITH_64_BITS_GUESTS */
    16941688
    1695     return vmmdevHGCMCall(pThis, pReq, pReq->header.header.size, GCPhysReqHdr, f64Bits);
     1689        return vmmdevHGCMCall(pThis, pReq, pReq->header.header.size, GCPhysReqHdr, f64Bits);
     1690    }
     1691
     1692    Log(("VMMDevReq_HGCMCall: HGCM Connector is NULL!\n"));
     1693    return VERR_NOT_SUPPORTED;
    16961694}
    16971695
     
    17091707    AssertMsgReturn(pReq->header.header.size >= sizeof(*pReq), ("%u\n", pReq->header.header.size), VERR_INVALID_PARAMETER);  /** @todo Not sure why this >= ... */
    17101708
    1711     if (!pThis->pHGCMDrv)
    1712     {
    1713         Log(("VMMDevReq_VMMDevHGCMCancel: HGCM Connector is NULL!\n"));
    1714         return VERR_NOT_SUPPORTED;
    1715     }
    1716 
    1717     Log(("VMMDevReq_VMMDevHGCMCancel\n"));
    1718     return vmmdevHGCMCancel(pThis, pReq, GCPhysReqHdr);
     1709    if (pThis->pHGCMDrv)
     1710    {
     1711        Log(("VMMDevReq_VMMDevHGCMCancel\n"));
     1712        return vmmdevHGCMCancel(pThis, pReq, GCPhysReqHdr);
     1713    }
     1714
     1715    Log(("VMMDevReq_VMMDevHGCMCancel: HGCM Connector is NULL!\n"));
     1716    return VERR_NOT_SUPPORTED;
    17191717}
    17201718
     
    17321730    AssertMsgReturn(pReq->header.size >= sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);  /** @todo Not sure why this >= ... */
    17331731
    1734     if (!pThis->pHGCMDrv)
    1735     {
    1736         Log(("VMMDevReq_HGCMConnect2: HGCM Connector is NULL!\n"));
    1737         return VERR_NOT_SUPPORTED;
    1738     }
    1739 
    1740     Log(("VMMDevReq_VMMDevHGCMCancel\n"));
    1741     return vmmdevHGCMCancel2(pThis, pReq->physReqToCancel);
     1732    if (pThis->pHGCMDrv)
     1733    {
     1734        Log(("VMMDevReq_HGCMCancel2\n"));
     1735        return vmmdevHGCMCancel2(pThis, pReq->physReqToCancel);
     1736    }
     1737
     1738    Log(("VMMDevReq_HGCMConnect2: HGCM Connector is NULL!\n"));
     1739    return VERR_NOT_SUPPORTED;
    17421740}
    17431741
     
    17591757    if (!pThis->pDrv)
    17601758    {
    1761         Log(("VMMDevReq_VideoAccelEnable Connector is NULL!!!\n"));
     1759        Log(("VMMDevReq_VideoAccelEnable Connector is NULL!!\n"));
    17621760        return VERR_NOT_SUPPORTED;
    17631761    }
     
    17651763    if (pReq->cbRingBuffer != VBVA_RING_BUFFER_SIZE)
    17661764    {
    1767         /* The guest driver seems compiled with another headers. */
    1768         Log(("VMMDevReq_VideoAccelEnable guest ring buffer size %d, should be %d!!!\n", pReq->cbRingBuffer, VBVA_RING_BUFFER_SIZE));
     1765        /* The guest driver seems compiled with different headers. */
     1766        LogRelMax(16,("VMMDevReq_VideoAccelEnable guest ring buffer size %#x, should be %#x!!\n", pReq->cbRingBuffer, VBVA_RING_BUFFER_SIZE));
    17691767        return VERR_INVALID_PARAMETER;
    17701768    }
     
    22972295                    ("%u cRegions=%u\n", pReq->header.size, pReq->cRegions), VERR_INVALID_PARAMETER);
    22982296
    2299     AssertReturn(memchr(pReq->szName, '\0', sizeof(pReq->szName)), VERR_INVALID_PARAMETER);
    2300     AssertReturn(memchr(pReq->szVersion, '\0', sizeof(pReq->szVersion)), VERR_INVALID_PARAMETER);
     2297    AssertReturn(RTStrEnd(pReq->szName, sizeof(pReq->szName)), VERR_INVALID_PARAMETER);
     2298    AssertReturn(RTStrEnd(pReq->szVersion, sizeof(pReq->szVersion)), VERR_INVALID_PARAMETER);
     2299    int rc = RTStrValidateEncoding(pReq->szName);
     2300    AssertRCReturn(rc, rc);
     2301    rc = RTStrValidateEncoding(pReq->szVersion);
     2302    AssertRCReturn(rc, rc);
    23012303
    23022304    /*
     
    23232325                    ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);
    23242326
    2325     AssertReturn(memchr(pReq->szName, '\0', sizeof(pReq->szName)), VERR_INVALID_PARAMETER);
    2326     AssertReturn(memchr(pReq->szVersion, '\0', sizeof(pReq->szVersion)), VERR_INVALID_PARAMETER);
     2327    AssertReturn(RTStrEnd(pReq->szName, sizeof(pReq->szName)), VERR_INVALID_PARAMETER);
     2328    AssertReturn(RTStrEnd(pReq->szVersion, sizeof(pReq->szVersion)), VERR_INVALID_PARAMETER);
     2329    int rc = RTStrValidateEncoding(pReq->szName);
     2330    AssertRCReturn(rc, rc);
     2331    rc = RTStrValidateEncoding(pReq->szVersion);
     2332    AssertRCReturn(rc, rc);
    23272333
    23282334    /*
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