VirtualBox

Ignore:
Timestamp:
Sep 26, 2011 2:31:45 PM (13 years ago)
Author:
vboxsync
Message:

CPUMR0.cpp: Log more regarding local apic mapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp

    r37955 r38868  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3737
    3838
     39/*******************************************************************************
     40*   Structures and Typedefs                                                    *
     41*******************************************************************************/
    3942#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
    40 /** Local APIC mappings */
    41 typedef struct
    42 {
     43/**
     44 * Local APIC mappings.
     45 */
     46typedef struct CPUMHOSTLAPIC
     47{
     48    /** Indicates that the entry is in use and have valid data. */
    4349    bool        fEnabled;
    44     uint64_t    PhysBase;
     50    /** Has APIC_REG_LVT_THMR. Not used. */
     51    uint32_t    fHasThermal;
     52    /** The physical address of the APIC registers. */
     53    RTHCPHYS    PhysBase;
     54    /** The memory object entering the physical address. */
    4555    RTR0MEMOBJ  hMemObj;
     56    /** The mapping object for hMemObj. */
    4657    RTR0MEMOBJ  hMapObj;
     58    /** The mapping address APIC registers.
     59     * @remarks Different CPUs may use the same physical address to map their
     60     *          APICs, so this pointer is only valid when on the CPU owning the
     61     *          APIC. */
    4762    void       *pv;
    48     uint32_t    fHasThermal;
    4963} CPUMHOSTLAPIC;
    50 
     64#endif
     65
     66
     67/*******************************************************************************
     68*   Global Variables                                                           *
     69*******************************************************************************/
     70#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
    5171static CPUMHOSTLAPIC g_aLApics[RTCPUSET_MAX_CPUS];
     72#endif
     73
     74
     75/*******************************************************************************
     76*   Internal Functions                                                         *
     77*******************************************************************************/
     78#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
    5279static int  cpumR0MapLocalApics(void);
    5380static void cpumR0UnmapLocalApics(void);
     
    638665}
    639666
    640 
    641667#ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
     668
    642669/**
    643670 * Worker for cpumR0MapLocalApics. Check each CPU for a present Local APIC.
     
    669696            uint32_t u32MaxExtIdx;
    670697            ASMCpuId(0x80000000, &u32MaxExtIdx, &u32EBX, &u32ECX, &u32EDX);
    671             if (   u32MaxExtIdx >= 0x80000008
    672                 && u32MaxExtIdx <  0x8000ffff)
     698            if (   u32MaxExtIdx >= UINT32_C(0x80000008)
     699                && u32MaxExtIdx <  UINT32_C(0x8000ffff))
    673700            {
    674701                uint32_t u32PhysBits;
     
    678705            }
    679706
    680             g_aLApics[iCpu].fEnabled = true;
    681             g_aLApics[iCpu].PhysBase = u64ApicBase & u64Mask;
     707            uint64_t const u64PhysBase = u64ApicBase & u64Mask;
     708            g_aLApics[iCpu].PhysBase   = (RTHCPHYS)u64PhysBase;
     709            g_aLApics[iCpu].fEnabled   = g_aLApics[iCpu].PhysBase == u64PhysBase;
    682710        }
    683711    }
     
    725753                     * 0x2X..0xFF reserved
    726754                     */
     755                    /** @todo r=bird: The local APIC is usually at the same address for all CPUs,
     756                     *        and therefore inaccessible by the other CPUs. */
    727757                    uint32_t ApicVersion = ApicRegRead(pvApicBase, APIC_REG_VERSION);
    728758                    if ((APIC_REG_VERSION_GET_VER(ApicVersion) & 0xF0) == 0x10)
     
    730760                        g_aLApics[iCpu].fHasThermal = APIC_REG_VERSION_GET_MAX_LVT(ApicVersion) >= 5;
    731761                        g_aLApics[iCpu].pv          = pvApicBase;
     762                        Log(("CPUM: APIC %02u at %RGp (mapped at %p) - ver %#x, lint0=%#x lint1=%#x pc=%#x thmr=%#x\n",
     763                             iCpu, g_aLApics[iCpu].PhysBase, g_aLApics[iCpu].pv, ApicVersion,
     764                             ApicRegRead(pvApicBase, APIC_REG_LVT_LINT0),
     765                             ApicRegRead(pvApicBase, APIC_REG_LVT_LINT1),
     766                             ApicRegRead(pvApicBase, APIC_REG_LVT_PC),
     767                             ApicRegRead(pvApicBase, APIC_REG_LVT_THMR)
     768                             ));
    732769                        continue;
    733770                    }
     
    785822
    786823#endif /* VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI */
     824
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