VirtualBox

Changeset 37591 in vbox for trunk/src/VBox/VMM/VMMR3/VMM.cpp


Ignore:
Timestamp:
Jun 22, 2011 3:58:22 PM (13 years ago)
Author:
vboxsync
Message:

RTLog,VMM,Main,SUPDrv: Restrict VM release logging by group - major support driver version change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r37452 r37591  
    339339{
    340340    int rc;
     341#define RTLogCalcSizeForR0(cGroups, fFlags) (RT_OFFSETOF(VMMR0LOGGER, Logger.afGroups[cGroups]) + PAGE_SIZE)
    341342
    342343    /*
     
    354355
    355356# ifdef VBOX_WITH_R0_LOGGING
     357        size_t const cbLogger = RTLogCalcSizeForR0(pLogger->cGroups, 0);
    356358        for (VMCPUID i = 0; i < pVM->cCpus; i++)
    357359        {
    358360            PVMCPU pVCpu = &pVM->aCpus[i];
    359 
    360             rc = MMR3HyperAllocOnceNoRelEx(pVM, RT_OFFSETOF(VMMR0LOGGER, Logger.afGroups[pLogger->cGroups]),
    361                                            0, MM_TAG_VMM, MMHYPER_AONR_FLAGS_KERNEL_MAPPING,
     361            rc = MMR3HyperAllocOnceNoRelEx(pVM, cbLogger, PAGE_SIZE, MM_TAG_VMM, MMHYPER_AONR_FLAGS_KERNEL_MAPPING,
    362362                                           (void **)&pVCpu->vmm.s.pR0LoggerR3);
    363363            if (RT_FAILURE(rc))
    364364                return rc;
    365             pVCpu->vmm.s.pR0LoggerR3->pVM = pVM->pVMR0;
     365            pVCpu->vmm.s.pR0LoggerR3->pVM        = pVM->pVMR0;
    366366            //pVCpu->vmm.s.pR0LoggerR3->fCreated = false;
    367             pVCpu->vmm.s.pR0LoggerR3->cbLogger = RT_OFFSETOF(RTLOGGER, afGroups[pLogger->cGroups]);
     367            pVCpu->vmm.s.pR0LoggerR3->cbLogger   = cbLogger;
    368368            pVCpu->vmm.s.pR0LoggerR0 = MMHyperR3ToR0(pVM, pVCpu->vmm.s.pR0LoggerR3);
    369369        }
     
    861861        pVM->vmm.s.pRCLoggerRC = MMHyperR3ToRC(pVM, pVM->vmm.s.pRCLoggerR3);
    862862        rc = RTLogCloneRC(NULL /* default */, pVM->vmm.s.pRCLoggerR3, pVM->vmm.s.cbRCLogger,
    863                           RCPtrLoggerWrapper,  RCPtrLoggerFlush, RTLOGFLAGS_BUFFERED);
     863                          RCPtrLoggerWrapper, RCPtrLoggerFlush, RTLOGFLAGS_BUFFERED);
    864864        AssertReleaseMsgRC(rc, ("RTLogCloneRC failed! rc=%Rra\n", rc));
    865865    }
     
    874874        pVM->vmm.s.pRCRelLoggerRC = MMHyperR3ToRC(pVM, pVM->vmm.s.pRCRelLoggerR3);
    875875        rc = RTLogCloneRC(RTLogRelDefaultInstance(), pVM->vmm.s.pRCRelLoggerR3, pVM->vmm.s.cbRCRelLogger,
    876                           RCPtrLoggerWrapper,  RCPtrLoggerFlush, RTLOGFLAGS_BUFFERED);
     876                          RCPtrLoggerWrapper, RCPtrLoggerFlush, RTLOGFLAGS_BUFFERED);
    877877        AssertReleaseMsgRC(rc, ("RTLogCloneRC failed! rc=%Rra\n", rc));
    878878    }
     
    884884     * in ring-0. Only initialize it once.
    885885     */
     886    PRTLOGGER const pDefault = RTLogRelDefaultInstance();
    886887    for (VMCPUID i = 0; i < pVM->cCpus; i++)
    887888    {
     
    900901                AssertReleaseMsgRCReturn(rc, ("vmmR0LoggerFlush not found! rc=%Rra\n", rc), rc);
    901902
    902                 rc = RTLogCreateForR0(&pR0LoggerR3->Logger, pR0LoggerR3->cbLogger,
    903                                       *(PFNRTLOGGER *)&pfnLoggerWrapper, *(PFNRTLOGFLUSH *)&pfnLoggerFlush,
     903                rc = RTLogCreateForR0(&pR0LoggerR3->Logger, pR0LoggerR3->cbLogger, pVCpu->vmm.s.pR0LoggerR0,
     904                                      pfnLoggerWrapper, pfnLoggerFlush,
    904905                                      RTLOGFLAGS_BUFFERED, RTLOGDEST_DUMMY);
    905906                AssertReleaseMsgRCReturn(rc, ("RTLogCreateForR0 failed! rc=%Rra\n", rc), rc);
     
    908909                rc = PDMR3LdrGetSymbolR0(pVM, VMMR0_MAIN_MODULE_NAME, "vmmR0LoggerPrefix", &pfnLoggerPrefix);
    909910                AssertReleaseMsgRCReturn(rc, ("vmmR0LoggerPrefix not found! rc=%Rra\n", rc), rc);
    910                 rc = RTLogSetCustomPrefixCallback(&pR0LoggerR3->Logger, *(PFNRTLOGPREFIX *)&pfnLoggerPrefix, NULL);
     911                rc = RTLogSetCustomPrefixCallbackForR0(&pR0LoggerR3->Logger, pVCpu->vmm.s.pR0LoggerR0, pfnLoggerPrefix, NULL);
    911912                AssertReleaseMsgRCReturn(rc, ("RTLogSetCustomPrefixCallback failed! rc=%Rra\n", rc), rc);
    912913
     
    917918            }
    918919
    919             rc = RTLogCopyGroupsAndFlags(&pR0LoggerR3->Logger, NULL /* default */, pVM->vmm.s.pRCLoggerR3->fFlags, RTLOGFLAGS_BUFFERED);
     920            rc = RTLogCopyGroupsAndFlagsForR0(&pR0LoggerR3->Logger, pVCpu->vmm.s.pR0LoggerR0, pDefault,
     921                                              UINT32_MAX, RTLOGFLAGS_BUFFERED);
    920922            AssertRC(rc);
    921923        }
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