VirtualBox

Changeset 44991 in vbox


Ignore:
Timestamp:
Mar 11, 2013 2:55:10 PM (12 years ago)
Author:
vboxsync
Message:

VBoxGuest-win*: More review + cleanup.

Location:
trunk/src/VBox/Additions/common/VBoxGuest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp

    r44988 r44991  
    254254
    255255            /* Free hardware resources. */
    256             /* @todo this should actually free I/O ports, interrupts, etc. */
     256            /** @todo this should actually free I/O ports, interrupts, etc.
     257             * Update/bird: vbgdNtCleanup actually does that... So, what's there to do?  */
    257258            rc = vbgdNtCleanup(pDevObj);
    258259            Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: vbgdNtCleanup rc = 0x%08X\n", rc));
     
    349350
    350351            /* Free hardware resources. */
    351             /* @todo this should actually free I/O ports, interrupts, etc. */
     352            /** @todo this should actually free I/O ports, interrupts, etc.
     353             * Update/bird: vbgdNtCleanup actually does that... So, what's there to do?  */
    352354            rc = vbgdNtCleanup(pDevObj);
    353355            Log(("VBoxGuest::vbgdNtGuestPnp: STOP_DEVICE: cleaning up, rc = 0x%x\n", rc));
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp

    r44990 r44991  
    515515        pDevExt->pInterruptObject = NULL;
    516516
     517    /** @todo r=bird: The error cleanup here is completely missing. We'll leak a
     518     *        whole bunch of things... */
     519
    517520    Log(("VBoxGuest::vbgdNtInit: Returned with rc = 0x%x\n", rc));
    518521    return rc;
     
    582585     * opened, at least we'll blindly assume that here.
    583586     */
    584     UNICODE_STRING win32Name;
    585     RtlInitUnicodeString(&win32Name, VBOXGUEST_DEVICE_NAME_DOS);
    586     NTSTATUS rc = IoDeleteSymbolicLink(&win32Name);
     587    UNICODE_STRING DosName;
     588    RtlInitUnicodeString(&DosName, VBOXGUEST_DEVICE_NAME_DOS);
     589    NTSTATUS rc = IoDeleteSymbolicLink(&DosName);
    587590
    588591    IoDeleteDevice(pDrvObj->DeviceObject);
    589 #else /* TARGET_NT4 */
     592#else  /* !TARGET_NT4 */
    590593    /* On a PnP driver this routine will be called after
    591594     * IRP_MN_REMOVE_DEVICE (where we already did the cleanup),
    592595     * so don't do anything here (yet). */
    593 #endif
     596#endif /* !TARGET_NT4 */
    594597
    595598    Log(("VBoxGuest::vbgdNtGuestUnload: returning\n"));
     
    11031106                {
    11041107                    Log(("VBoxGuest::vbgdNtScanPCIResourceList: I/O range: Base = %08x:%08x, Length = %08x\n",
    1105                             pPartialData->u.Port.Start.HighPart,
    1106                             pPartialData->u.Port.Start.LowPart,
    1107                             pPartialData->u.Port.Length));
     1108                         pPartialData->u.Port.Start.HighPart,
     1109                         pPartialData->u.Port.Start.LowPart,
     1110                         pPartialData->u.Port.Length));
    11081111
    11091112                    /* Save the IO port base. */
    1110                     /** @todo Not so good. */
     1113                    /** @todo Not so good.
     1114                     * Update/bird: What is not so good? That we just consider the last range?  */
    11111115                    pDevExt->Core.IOPortBase = (RTIOPORT)pPartialData->u.Port.Start.LowPart;
    11121116
     
    11181122
    11191123                    Log(("VBoxGuest::vbgdNtScanPCIResourceList: I/O range for VMMDev found! Base = %08x:%08x, Length = %08x\n",
    1120                             pPartialData->u.Port.Start.HighPart,
    1121                             pPartialData->u.Port.Start.LowPart,
    1122                             pPartialData->u.Port.Length));
     1124                         pPartialData->u.Port.Start.HighPart,
     1125                         pPartialData->u.Port.Start.LowPart,
     1126                         pPartialData->u.Port.Length));
    11231127
    11241128                    /* Next item ... */
     
    12101214 *
    12111215 * @param pDevExt           The device extension.
    1212  * @param physicalAdr       Physical address to map.
    1213  * @param ulLength          Length (in bytes) to map.
     1216 * @param PhysAddr          Physical address to map.
     1217 * @param cbToMap           Number of bytes to map.
    12141218 * @param ppvMMIOBase       Pointer of mapped I/O base.
    12151219 * @param pcbMMIO           Length of mapped I/O base.
    12161220 */
    1217 NTSTATUS vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXTWIN pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
     1221NTSTATUS vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXTWIN pDevExt, PHYSICAL_ADDRESS PhysAddr, ULONG cbToMap,
    12181222                               void **ppvMMIOBase, uint32_t *pcbMMIO)
    12191223{
     
    12231227
    12241228    NTSTATUS rc = STATUS_SUCCESS;
    1225     if (physicalAdr.LowPart > 0) /* We're mapping below 4GB. */
    1226     {
    1227          VMMDevMemory *pVMMDevMemory = (VMMDevMemory *)MmMapIoSpace(physicalAdr, ulLength, MmNonCached);
     1229    if (PhysAddr.LowPart > 0) /* We're mapping below 4GB. */
     1230    {
     1231         VMMDevMemory *pVMMDevMemory = (VMMDevMemory *)MmMapIoSpace(PhysAddr, cbToMap, MmNonCached);
    12281232         Log(("VBoxGuest::vbgdNtMapVMMDevMemory: pVMMDevMemory = 0x%x\n", pVMMDevMemory));
    12291233         if (pVMMDevMemory)
     
    12331237
    12341238             /* Check version of the structure; do we have the right memory version? */
    1235              if (pVMMDevMemory->u32Version != VMMDEV_MEMORY_VERSION)
    1236              {
    1237                  Log(("VBoxGuest::vbgdNtMapVMMDevMemory: Wrong version (%u), refusing operation!\n",
    1238                       pVMMDevMemory->u32Version));
    1239 
    1240                  /* Not our version, refuse operation and unmap the memory. */
    1241                  vbgdNtUnmapVMMDevMemory(pDevExt);
    1242                  rc = STATUS_UNSUCCESSFUL;
    1243              }
    1244              else
     1239             if (pVMMDevMemory->u32Version == VMMDEV_MEMORY_VERSION)
    12451240             {
    12461241                 /* Save results. */
     
    12511246                 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: VMMDevMemory found and mapped! pvMMIOBase = 0x%p\n",
    12521247                      *ppvMMIOBase));
     1248             }
     1249             else
     1250             {
     1251                 /* Not our version, refuse operation and unmap the memory. */
     1252                 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: Wrong version (%u), refusing operation!\n", pVMMDevMemory->u32Version));
     1253                 vbgdNtUnmapVMMDevMemory(pDevExt);
     1254                 rc = STATUS_UNSUCCESSFUL;
    12531255             }
    12541256         }
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h

    r44988 r44991  
    172172BOOLEAN    vbgdNtIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext);
    173173NTSTATUS   vbgdNtScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXTWIN pDevExt);
    174 NTSTATUS   vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXTWIN pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
     174NTSTATUS   vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXTWIN pDevExt, PHYSICAL_ADDRESS PhysAddr, ULONG cbToMap,
    175175                                 void **ppvMMIOBase, uint32_t *pcbMMIO);
    176176void       vbgdNtUnmapVMMDevMemory(PVBOXGUESTDEVEXTWIN pDevExt);
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