VirtualBox

Changeset 26001 in vbox for trunk/src/VBox/Devices/VMMDev


Ignore:
Timestamp:
Jan 25, 2010 2:21:13 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56881
Message:

PDM,*: Redid the PDM structure versions. Check the instance and helper versions in every device and driver constructor.

File:
1 edited

Legend:

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

    r25985 r26001  
    24042404}
    24052405
     2406/* -=-=-=-=- PDMDEVREG -=-=-=-=- */
     2407
    24062408/**
    24072409 * (Re-)initializes the MMIO2 data.
     
    24152417    pThis->pVMMDevRAMR3->u32Version = VMMDEV_MEMORY_VERSION;
    24162418}
     2419
     2420/**
     2421 * Reset notification.
     2422 *
     2423 * @returns VBox status.
     2424 * @param   pDrvIns     The driver instance data.
     2425 */
     2426static DECLCALLBACK(void) vmmdevReset(PPDMDEVINS pDevIns)
     2427{
     2428    VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*);
     2429
     2430    /*
     2431     * Reset the mouse integration feature bits
     2432     */
     2433    if (pThis->mouseCapabilities & VMMDEV_MOUSE_GUEST_MASK)
     2434    {
     2435        pThis->mouseCapabilities &= ~VMMDEV_MOUSE_GUEST_MASK;
     2436        /* notify the connector */
     2437        Log(("vmmdevReset: capabilities changed (%x), informing connector\n", pThis->mouseCapabilities));
     2438        pThis->pDrv->pfnUpdateMouseCapabilities(pThis->pDrv, pThis->mouseCapabilities);
     2439    }
     2440    pThis->fHostCursorRequested = false;
     2441
     2442    pThis->hypervisorSize = 0;
     2443
     2444    pThis->u32HostEventFlags = 0;
     2445
     2446    /* re-initialize the VMMDev memory */
     2447    if (pThis->pVMMDevRAMR3)
     2448        vmmdevInitRam(pThis);
     2449
     2450    /* credentials have to go away (by default) */
     2451    if (!pThis->fKeepCredentials)
     2452    {
     2453        memset(pThis->credentialsLogon.szUserName, '\0', VMMDEV_CREDENTIALS_STRLEN);
     2454        memset(pThis->credentialsLogon.szPassword, '\0', VMMDEV_CREDENTIALS_STRLEN);
     2455        memset(pThis->credentialsLogon.szDomain, '\0', VMMDEV_CREDENTIALS_STRLEN);
     2456    }
     2457    memset(pThis->credentialsJudge.szUserName, '\0', VMMDEV_CREDENTIALS_STRLEN);
     2458    memset(pThis->credentialsJudge.szPassword, '\0', VMMDEV_CREDENTIALS_STRLEN);
     2459    memset(pThis->credentialsJudge.szDomain, '\0', VMMDEV_CREDENTIALS_STRLEN);
     2460
     2461    /* Reset means that additions will report again. */
     2462    const bool fVersionChanged = pThis->fu32AdditionsOk
     2463                              || pThis->guestInfo.additionsVersion
     2464                              || pThis->guestInfo.osType != VBOXOSTYPE_Unknown;
     2465    if (fVersionChanged)
     2466        Log(("vmmdevReset: fu32AdditionsOk=%d additionsVersion=%x osType=%#x\n",
     2467             pThis->fu32AdditionsOk, pThis->guestInfo.additionsVersion, pThis->guestInfo.osType));
     2468    pThis->fu32AdditionsOk = false;
     2469    memset (&pThis->guestInfo, 0, sizeof (pThis->guestInfo));
     2470
     2471    /* clear pending display change request. */
     2472    memset (&pThis->lastReadDisplayChangeRequest, 0, sizeof (pThis->lastReadDisplayChangeRequest));
     2473    pThis->fGuestSentChangeEventAck = false;
     2474
     2475    /* disable seamless mode */
     2476    pThis->fLastSeamlessEnabled = false;
     2477
     2478    /* disabled memory ballooning */
     2479    pThis->u32LastMemoryBalloonSize = 0;
     2480
     2481    /* disabled statistics updating */
     2482    pThis->u32LastStatIntervalSize = 0;
     2483
     2484    /* Clear the "HGCM event enabled" flag so the event can be automatically reenabled.  */
     2485    pThis->u32HGCMEnabled = 0;
     2486
     2487    /*
     2488     * Clear the event variables.
     2489     *
     2490     *   Note: The pThis->u32HostEventFlags is not cleared.
     2491     *         It is designed that way so host events do not
     2492     *         depend on guest resets.
     2493     */
     2494    pThis->u32GuestFilterMask    = 0;
     2495    pThis->u32NewGuestFilterMask = 0;
     2496    pThis->fNewGuestFilterMask   = 0;
     2497
     2498    /* This is the default, as Windows and OS/2 guests take this for granted. (Actually, neither does...) */
     2499    /** @todo change this when we next bump the interface version */
     2500    const bool fCapsChanged = pThis->guestCaps != VMMDEV_GUEST_SUPPORTS_GRAPHICS;
     2501    if (fCapsChanged)
     2502        Log(("vmmdevReset: fCapsChanged=%#x -> %#x\n", pThis->guestCaps, VMMDEV_GUEST_SUPPORTS_GRAPHICS));
     2503    pThis->guestCaps = VMMDEV_GUEST_SUPPORTS_GRAPHICS; /** @todo r=bird: why? I cannot see this being done at construction?*/
     2504
     2505    /*
     2506     * Call the update functions as required.
     2507     */
     2508    if (fVersionChanged)
     2509        pThis->pDrv->pfnUpdateGuestVersion(pThis->pDrv, &pThis->guestInfo);
     2510    if (fCapsChanged)
     2511        pThis->pDrv->pfnUpdateGuestCapabilities(pThis->pDrv, pThis->guestCaps);
     2512}
     2513
    24172514
    24182515/**
     
    24352532
    24362533    Assert(iInstance == 0);
     2534    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    24372535
    24382536    /*
     
    26372735
    26382736    return rc;
    2639 }
    2640 
    2641 /**
    2642  * Reset notification.
    2643  *
    2644  * @returns VBox status.
    2645  * @param   pDrvIns     The driver instance data.
    2646  */
    2647 static DECLCALLBACK(void) vmmdevReset(PPDMDEVINS pDevIns)
    2648 {
    2649     VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState*);
    2650 
    2651     /*
    2652      * Reset the mouse integration feature bits
    2653      */
    2654     if (pThis->mouseCapabilities & VMMDEV_MOUSE_GUEST_MASK)
    2655     {
    2656         pThis->mouseCapabilities &= ~VMMDEV_MOUSE_GUEST_MASK;
    2657         /* notify the connector */
    2658         Log(("vmmdevReset: capabilities changed (%x), informing connector\n", pThis->mouseCapabilities));
    2659         pThis->pDrv->pfnUpdateMouseCapabilities(pThis->pDrv, pThis->mouseCapabilities);
    2660     }
    2661     pThis->fHostCursorRequested = false;
    2662 
    2663     pThis->hypervisorSize = 0;
    2664 
    2665     pThis->u32HostEventFlags = 0;
    2666 
    2667     /* re-initialize the VMMDev memory */
    2668     if (pThis->pVMMDevRAMR3)
    2669         vmmdevInitRam(pThis);
    2670 
    2671     /* credentials have to go away (by default) */
    2672     if (!pThis->fKeepCredentials)
    2673     {
    2674         memset(pThis->credentialsLogon.szUserName, '\0', VMMDEV_CREDENTIALS_STRLEN);
    2675         memset(pThis->credentialsLogon.szPassword, '\0', VMMDEV_CREDENTIALS_STRLEN);
    2676         memset(pThis->credentialsLogon.szDomain, '\0', VMMDEV_CREDENTIALS_STRLEN);
    2677     }
    2678     memset(pThis->credentialsJudge.szUserName, '\0', VMMDEV_CREDENTIALS_STRLEN);
    2679     memset(pThis->credentialsJudge.szPassword, '\0', VMMDEV_CREDENTIALS_STRLEN);
    2680     memset(pThis->credentialsJudge.szDomain, '\0', VMMDEV_CREDENTIALS_STRLEN);
    2681 
    2682     /* Reset means that additions will report again. */
    2683     const bool fVersionChanged = pThis->fu32AdditionsOk
    2684                               || pThis->guestInfo.additionsVersion
    2685                               || pThis->guestInfo.osType != VBOXOSTYPE_Unknown;
    2686     if (fVersionChanged)
    2687         Log(("vmmdevReset: fu32AdditionsOk=%d additionsVersion=%x osType=%#x\n",
    2688              pThis->fu32AdditionsOk, pThis->guestInfo.additionsVersion, pThis->guestInfo.osType));
    2689     pThis->fu32AdditionsOk = false;
    2690     memset (&pThis->guestInfo, 0, sizeof (pThis->guestInfo));
    2691 
    2692     /* clear pending display change request. */
    2693     memset (&pThis->lastReadDisplayChangeRequest, 0, sizeof (pThis->lastReadDisplayChangeRequest));
    2694     pThis->fGuestSentChangeEventAck = false;
    2695 
    2696     /* disable seamless mode */
    2697     pThis->fLastSeamlessEnabled = false;
    2698 
    2699     /* disabled memory ballooning */
    2700     pThis->u32LastMemoryBalloonSize = 0;
    2701 
    2702     /* disabled statistics updating */
    2703     pThis->u32LastStatIntervalSize = 0;
    2704 
    2705     /* Clear the "HGCM event enabled" flag so the event can be automatically reenabled.  */
    2706     pThis->u32HGCMEnabled = 0;
    2707 
    2708     /*
    2709      * Clear the event variables.
    2710      *
    2711      *   Note: The pThis->u32HostEventFlags is not cleared.
    2712      *         It is designed that way so host events do not
    2713      *         depend on guest resets.
    2714      */
    2715     pThis->u32GuestFilterMask    = 0;
    2716     pThis->u32NewGuestFilterMask = 0;
    2717     pThis->fNewGuestFilterMask   = 0;
    2718 
    2719     /* This is the default, as Windows and OS/2 guests take this for granted. (Actually, neither does...) */
    2720     /** @todo change this when we next bump the interface version */
    2721     const bool fCapsChanged = pThis->guestCaps != VMMDEV_GUEST_SUPPORTS_GRAPHICS;
    2722     if (fCapsChanged)
    2723         Log(("vmmdevReset: fCapsChanged=%#x -> %#x\n", pThis->guestCaps, VMMDEV_GUEST_SUPPORTS_GRAPHICS));
    2724     pThis->guestCaps = VMMDEV_GUEST_SUPPORTS_GRAPHICS; /** @todo r=bird: why? I cannot see this being done at construction?*/
    2725 
    2726     /*
    2727      * Call the update functions as required.
    2728      */
    2729     if (fVersionChanged)
    2730         pThis->pDrv->pfnUpdateGuestVersion(pThis->pDrv, &pThis->guestInfo);
    2731     if (fCapsChanged)
    2732         pThis->pDrv->pfnUpdateGuestCapabilities(pThis->pDrv, pThis->guestCaps);
    27332737}
    27342738
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