VirtualBox

Changeset 92579 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Nov 24, 2021 3:04:08 AM (3 years ago)
Author:
vboxsync
Message:

VMM/NEM-linux: Implemented the apic_base synchronization, ubuntu now boots with x2APIC. bugref:9044

File:
1 edited

Legend:

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

    r92578 r92579  
    12361236
    12371237    /*
    1238      * Stuff that goes into kvm_run::s.regs.sregs:
    1239      */
    1240     /** @todo apic_base   */
    1241 
     1238     * Stuff that goes into kvm_run::s.regs.sregs.
     1239     *
     1240     * Note! The apic_base can be ignored because we gets all MSR writes to it
     1241     *       and VBox always keeps the correct value.
     1242     */
    12421243    bool fMaybeChangedMode = false;
    12431244    bool fUpdateCr3        = false;
     
    13371338            }
    13381339        }
    1339 
    1340         /** @todo apic_base   */
    13411340#undef NEM_LNX_IMPORT_SEG
    13421341    }
     
    16431642    /*
    16441643     * Stuff that goes into kvm_run::s.regs.sregs:
    1645      */
    1646     /** @todo apic_base   */
    1647     if (fExtrn & (  CPUMCTX_EXTRN_SREG_MASK | CPUMCTX_EXTRN_TABLE_MASK | CPUMCTX_EXTRN_CR_MASK
    1648                   | CPUMCTX_EXTRN_EFER      | CPUMCTX_EXTRN_APIC_TPR))
    1649     {
     1644     *
     1645     * The APIC base register updating is a little suboptimal... But at least
     1646     * VBox always has the right base register value, so it's one directional.
     1647     */
     1648    uint64_t const uApicBase = APICGetBaseMsrNoCheck(pVCpu);
     1649    if (   (fExtrn & (  CPUMCTX_EXTRN_SREG_MASK | CPUMCTX_EXTRN_TABLE_MASK | CPUMCTX_EXTRN_CR_MASK
     1650                      | CPUMCTX_EXTRN_EFER      | CPUMCTX_EXTRN_APIC_TPR))
     1651        || uApicBase != pVCpu->nem.s.uKvmApicBase)
     1652    {
     1653        if ((pVCpu->nem.s.uKvmApicBase ^ uApicBase) & MSR_IA32_APICBASE_EN)
     1654            Log(("NEM/%u: APICBASE_EN changed %#010RX64 -> %#010RX64\n", pVCpu->idCpu, pVCpu->nem.s.uKvmApicBase, uApicBase));
     1655        pRun->s.regs.sregs.apic_base = uApicBase;
     1656        pVCpu->nem.s.uKvmApicBase    = uApicBase;
     1657
     1658        if (fExtrn & CPUMCTX_EXTRN_APIC_TPR)
     1659            pRun->s.regs.sregs.cr8   = CPUMGetGuestCR8(pVCpu);
     1660
    16501661#define NEM_LNX_EXPORT_SEG(a_KvmSeg, a_CtxSeg) do { \
    16511662            (a_KvmSeg).base     = (a_CtxSeg).u64Base; \
     
    17131724                pRun->s.regs.sregs.cr4   = pCtx->cr4;
    17141725        }
    1715         if (fExtrn & CPUMCTX_EXTRN_APIC_TPR)
    1716             pRun->s.regs.sregs.cr8    = CPUMGetGuestCR8(pVCpu);
    17171726        if (fExtrn & CPUMCTX_EXTRN_EFER)
    17181727            pRun->s.regs.sregs.efer   = pCtx->msrEFER;
    1719 
    1720         /** @todo apic_base   */
    17211728
    17221729        RT_ZERO(pRun->s.regs.sregs.interrupt_bitmap); /* this is an alternative interrupt injection interface */
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