VirtualBox

Changeset 90829 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Aug 24, 2021 10:26:07 AM (3 years ago)
Author:
vboxsync
Message:

IPRT,VMM,SUPDrv,++: Reworked the IPRT logger structure and how the VMM ring-0 uses it. bugref:10086

Location:
trunk/src/VBox/VMM/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/VMMInternal.h

    r90597 r90829  
    6767
    6868/**
    69  * The ring-0 logger instance wrapper.
    70  *
    71  * We need to be able to find the VM handle from the logger instance, so we wrap
    72  * it in this structure.
    73  */
    74 typedef struct VMMR0LOGGER
     69 * R0 logger data (ring-0 only data).
     70 */
     71typedef struct VMMR0PERVCPULOGGER
    7572{
    76     /** Pointer to Pointer to the VM. */
    77     R0PTRTYPE(PVMCC)            pVM;
    78     /** Size of the allocated logger instance (Logger). */
    79     uint32_t                    cbLogger;
    80     /** Flag indicating whether we've create the logger Ring-0 instance yet. */
    81     bool                        fCreated;
    82     /** Flag indicating whether we've disabled flushing (world switch) or not. */
    83     bool                        fFlushingDisabled;
     73    /** Pointer to the logger instance.
     74     * The RTLOGGER::u32UserValue1 member is used for flags and magic, while the
     75     * RTLOGGER::u64UserValue2 member is the corresponding PGVMCPU value.
     76     * RTLOGGER::u64UserValue3 is currently and set to the PGVMCPU value too. */
     77    R0PTRTYPE(PRTLOGGER)    pLogger;
     78    /** Log buffer descriptor.
     79     * The buffer is allocated in a common block for all VCpus, see VMMR0PERVM. */
     80    RTLOGBUFFERDESC         BufDesc;
    8481    /** Flag indicating whether we've registered the instance already. */
    85     bool                        fRegistered;
    86     bool                        a8Alignment;
    87     /** The CPU ID. */
    88     VMCPUID                     idCpu;
    89 #if HC_ARCH_BITS == 64
    90     uint32_t                    u32Alignment;
    91 #endif
    92     /** The ring-0 logger instance. This extends beyond the size.  */
    93     RTLOGGER                    Logger;
    94 } VMMR0LOGGER;
    95 /** Pointer to a ring-0 logger instance wrapper. */
    96 typedef VMMR0LOGGER *PVMMR0LOGGER;
     82    bool                    fRegistered;
     83    bool                    afPadding[7];
     84} VMMR0PERVCPULOGGER;
     85/** Pointer to the R0 logger data (ring-0 only). */
     86typedef VMMR0PERVCPULOGGER *PVMMR0PERVCPULOGGER;
     87
     88
     89/**
     90 * R0 logger data shared with ring-3 (per CPU).
     91 */
     92typedef struct VMMR3CPULOGGER
     93{
     94    /** Auxiliary buffer descriptor. */
     95    RTLOGBUFFERAUXDESC      AuxDesc;
     96    /** Ring-3 mapping of the logging buffer. */
     97    R3PTRTYPE(char *)       pchBufR3;
     98    /** The buffer size. */
     99    uint32_t                cbBuf;
     100    uint32_t                uReserved;
     101} VMMR3CPULOGGER;
     102/** Pointer to r0 logger data shared with ring-3. */
     103typedef VMMR3CPULOGGER *PVMMR3CPULOGGER;
    97104
    98105
     
    367374    R3PTRTYPE(uint8_t *)        pbEMTStackR3;
    368375
    369     /** Pointer to the R0 logger instance - R3 Ptr.
    370      * This is NULL if logging is disabled. */
    371     R3PTRTYPE(PVMMR0LOGGER)     pR0LoggerR3;
    372     /** Pointer to the R0 logger instance - R0 Ptr.
    373      * This is NULL if logging is disabled. */
    374     R0PTRTYPE(PVMMR0LOGGER)     pR0LoggerR0;
    375 
    376     /** Pointer to the R0 release logger instance - R3 Ptr.
    377      * This is NULL if logging is disabled. */
    378     R3PTRTYPE(PVMMR0LOGGER)     pR0RelLoggerR3;
    379     /** Pointer to the R0 release instance - R0 Ptr.
    380      * This is NULL if logging is disabled. */
    381     R0PTRTYPE(PVMMR0LOGGER)     pR0RelLoggerR0;
    382 
    383376    /** @name Rendezvous
    384377     * @{ */
     
    435428    VMMR0JMPBUF                 CallRing3JmpBufR0;
    436429    /** @} */
     430
     431    /** @name Logging
     432     * @{ */
     433    /** The R0 logger data shared with ring-3. */
     434    VMMR3CPULOGGER              Logger;
     435    /** The R0 release logger data shared with ring-3. */
     436    VMMR3CPULOGGER              RelLogger;
     437    /** @}  */
    437438
    438439    STAMPROFILE                 StatR0HaltBlock;
     
    462463    /** Set if we've entered HM context. */
    463464    bool volatile                       fInHmContext;
    464 
    465     bool                                afPadding[5];
     465    /** Flag indicating whether we've disabled flushing (world switch) or not. */
     466    bool                                fLogFlushingDisabled;
    466467    /** The EMT hash table index. */
    467468    uint16_t                            idxEmtHash;
     
    483484    PSUPDRVSESSION                      pSession;
    484485    /** @} */
     486
     487    /** @name Loggers
     488     * @{ */
     489    /** The R0 logger data. */
     490    VMMR0PERVCPULOGGER                  Logger;
     491    /** The R0 release logger data. */
     492    VMMR0PERVCPULOGGER                  RelLogger;
     493    /** @} */
    485494} VMMR0PERVCPU;
    486495/** Pointer to VMM ring-0 VMCPU instance data. */
    487496typedef VMMR0PERVCPU *PVMMR0PERVCPU;
    488497
     498/** @name RTLOGGER::u32UserValue1 Flags
     499 * @{ */
     500/** The magic value. */
     501#define VMMR0_LOGGER_FLAGS_MAGIC_VALUE          UINT32_C(0x7d297f05)
     502/** Part of the flags value used for the magic. */
     503#define VMMR0_LOGGER_FLAGS_MAGIC_MASK           UINT32_C(0xffffff0f)
     504/** Set if flushing is disabled (copy of fLogFlushingDisabled). */
     505#define VMMR0_LOGGER_FLAGS_FLUSHING_DISABLED    UINT32_C(0x00000010)
     506/** @} */
     507
     508
     509/**
     510 * VMM data kept in the ring-0 GVM.
     511 */
     512typedef struct VMMR0PERVM
     513{
     514    /** Logger (debug) buffer allocation.
     515     * This covers all CPUs.  */
     516    RTR0MEMOBJ          hMemObjLogger;
     517    /** The ring-3 mapping object for hMemObjLogger. */
     518    RTR0MEMOBJ          hMapObjLogger;
     519
     520    /** Release logger buffer allocation.
     521     * This covers all CPUs.  */
     522    RTR0MEMOBJ          hMemObjReleaseLogger;
     523    /** The ring-3 mapping object for hMemObjReleaseLogger. */
     524    RTR0MEMOBJ          hMapObjReleaseLogger;
     525
     526    /** Set if vmmR0InitVM has been called. */
     527    bool                fCalledInitVm;
     528} VMMR0PERVM;
    489529
    490530RT_C_DECLS_BEGIN
     
    593633DECLASM(int)    vmmR0CallRing3LongJmp(PVMMR0JMPBUF pJmpBuf, int rc);
    594634
    595 /**
    596  * Internal R0 logger worker: Logger wrapper.
    597  */
    598 VMMR0DECL(void) vmmR0LoggerWrapper(const char *pszFormat, ...);
    599 
    600 /**
    601  * Internal R0 logger worker: Flush logger.
    602  *
    603  * @param   pLogger     The logger instance to flush.
    604  * @remark  This function must be exported!
    605  */
    606 VMMR0DECL(void) vmmR0LoggerFlush(PRTLOGGER pLogger);
    607 
    608 /**
    609  * Internal R0 logger worker: Custom prefix.
    610  *
    611  * @returns Number of chars written.
    612  *
    613  * @param   pLogger     The logger instance.
    614  * @param   pchBuf      The output buffer.
    615  * @param   cchBuf      The size of the buffer.
    616  * @param   pvUser      User argument (ignored).
    617  */
    618 VMMR0DECL(size_t) vmmR0LoggerPrefix(PRTLOGGER pLogger, char *pchBuf, size_t cchBuf, void *pvUser);
    619 
    620635# ifdef VBOX_WITH_TRIPLE_FAULT_HACK
    621636int  vmmR0TripleFaultHackInit(void);
  • trunk/src/VBox/VMM/include/VMMInternal.mac

    r90379 r90829  
    116116        .pbEMTStackR3           RTR3PTR_RES 1
    117117
    118         .pR0LoggerR3            RTR3PTR_RES 1
    119         .pR0LoggerR0            RTR0PTR_RES 1
    120         .pR0RelLoggerR3         RTR3PTR_RES 1
    121         .pR0RelLoggerR0         RTR0PTR_RES 1
    122 
    123118        .fInRendezvous          resb 1
    124119        .afPadding1             resb 2
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