VirtualBox

Changeset 46762 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jun 24, 2013 5:05:11 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86690
Message:

VMM/HMSVMR0: AMD-V bits. Boots past the BIOS.

File:
1 edited

Legend:

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

    r46752 r46762  
    3232
    3333#ifdef DEBUG_ramshankar
     34# define HMVMX_SYNC_FULL_GUEST_STATE
    3435# define HMSVM_ALWAYS_TRAP_ALL_XCPTS
    3536# define HMSVM_ALWAYS_TRAP_PF
     
    11931194    {
    11941195        HMSVM_LOAD_SEG_REG(CS, cs);
    1195         HMSVM_LOAD_SEG_REG(SS, cs);
    1196         HMSVM_LOAD_SEG_REG(DS, cs);
    1197         HMSVM_LOAD_SEG_REG(ES, cs);
    1198         HMSVM_LOAD_SEG_REG(FS, cs);
    1199         HMSVM_LOAD_SEG_REG(GS, cs);
     1196        HMSVM_LOAD_SEG_REG(SS, ss);
     1197        HMSVM_LOAD_SEG_REG(DS, ds);
     1198        HMSVM_LOAD_SEG_REG(ES, es);
     1199        HMSVM_LOAD_SEG_REG(FS, fs);
     1200        HMSVM_LOAD_SEG_REG(GS, gs);
    12001201
    12011202        pVmcb->ctrl.u64VmcbCleanBits &= ~HMSVM_VMCB_CLEAN_SEG;
     
    15501551
    15511552/**
    1552  * Loads the guest state.
     1553 * Worker for loading the guest-state into the VMCB.
    15531554 *
    15541555 * @returns VBox status code.
     
    15591560 * @remarks No-long-jump zone!!!
    15601561 */
    1561 VMMR0DECL(int) SVMR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
    1562 {
    1563     AssertPtr(pVM);
    1564     AssertPtr(pVCpu);
    1565     AssertPtr(pCtx);
    1566     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    1567 
     1562static int hmR0SvmLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     1563{
    15681564    PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
    15691565    AssertMsgReturn(pVmcb, ("Invalid pVmcb\n"), VERR_SVM_INVALID_PVMCB);
     
    16081604              pVM, pVCpu, pVCpu->hm.s.fContextUseFlags));
    16091605
     1606    Log4(("Load: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip));
     1607
    16101608    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatLoadGuestState, x);
    1611 
    16121609    return rc;
     1610}
     1611
     1612
     1613/**
     1614 * Loads the guest state.
     1615 *
     1616 * @returns VBox status code.
     1617 * @param   pVM         Pointer to the VM.
     1618 * @param   pVCpu       Pointer to the VMCPU.
     1619 * @param   pCtx        Pointer to the guest-CPU context.
     1620 *
     1621 * @remarks No-long-jump zone!!!
     1622 */
     1623VMMR0DECL(int) SVMR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     1624{
     1625    /* Nothing to do here. Loading is done below before VM-entry. */
     1626    return VINF_SUCCESS;
    16131627}
    16141628
     
    16651679     * Guest segment registers (includes FS, GS base MSRs for 64-bit guests).
    16661680     */
    1667     HMSVM_SAVE_SEG_REG(CS, ss);
    1668     HMSVM_SAVE_SEG_REG(SS, cs);
     1681    HMSVM_SAVE_SEG_REG(CS, cs);
     1682    HMSVM_SAVE_SEG_REG(SS, ss);
    16691683    HMSVM_SAVE_SEG_REG(DS, ds);
    16701684    HMSVM_SAVE_SEG_REG(ES, es);
     
    19251939{
    19261940    Assert(!pVCpu->hm.s.Event.fPending);
     1941    Assert(pEvent->n.u1Valid);
    19271942
    19281943    pVCpu->hm.s.Event.u64IntrInfo       = pEvent->u;
     
    19301945    pVCpu->hm.s.Event.GCPtrFaultAddress = GCPtrFaultAddress;
    19311946
    1932 #ifdef VBOX_STRICT
    1933     if (GCPtrFaultAddress)
    1934     {
    1935         AssertMsg(   pEvent->n.u8Vector == X86_XCPT_PF
    1936                   && pEvent->n.u3Type   == SVM_EVENT_EXCEPTION,
    1937                   ("hmR0SvmSetPendingEvent: Setting fault-address for non-#PF. u8Vector=%#x Type=%#RX32 GCPtrFaultAddr=%#RGx\n",
    1938                    pEvent->n.u8Vector, (uint32_t)pEvent->n.u3Type, GCPtrFaultAddress));
    1939         Assert(GCPtrFaultAddress == CPUMGetGuestCR2(pVCpu));
    1940     }
    1941 #endif
    1942 
    1943     Log4(("hmR0SvmSetPendingEvent: u=%#RX64 u8Vector=%#x ErrorCodeValid=%#x ErrorCode=%#RX32\n", pEvent->u,
    1944           pEvent->n.u8Vector, pEvent->n.u3Type, (uint8_t)pEvent->n.u1ErrorCodeValid, pEvent->n.u32ErrorCode));
     1947    Log4(("hmR0SvmSetPendingEvent: u=%#RX64 u8Vector=%#x Type=%#x ErrorCodeValid=%RTbool ErrorCode=%#RX32\n", pEvent->u,
     1948          pEvent->n.u8Vector, (uint8_t)pEvent->n.u3Type, !!pEvent->n.u1ErrorCodeValid, pEvent->n.u32ErrorCode));
    19451949}
    19461950
     
    21632167    if (pVCpu->hm.s.Event.fPending)                            /* First, inject any pending HM events. */
    21642168    {
     2169        Event.u = pVCpu->hm.s.Event.u64IntrInfo;
    21652170        Assert(Event.n.u1Valid);
    2166         Event.u = pVCpu->hm.s.Event.u64IntrInfo;
    21672171        bool fInject = true;
    21682172        if (   fIntShadow
     
    25462550    pVmcb->ctrl.NestedPaging.n.u1NestedPaging = pVM->hm.s.fNestedPaging;
    25472551
     2552#ifdef HMVMX_SYNC_FULL_GUEST_STATE
     2553    pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_ALL_GUEST;
     2554#endif
     2555
    25482556    /* Load the guest state. */
    2549     int rc = SVMR0LoadGuestState(pVM, pVCpu, pCtx);
     2557    int rc = hmR0SvmLoadGuestState(pVM, pVCpu, pCtx);
    25502558    AssertRC(rc);
    25512559    AssertMsg(!pVCpu->hm.s.fContextUseFlags, ("fContextUseFlags =%#x\n", pVCpu->hm.s.fContextUseFlags));
     
    26732681    }
    26742682
    2675     pSvmTransient->u64ExitCode   = pVmcb->ctrl.u64ExitCode;     /* Save the #VMEXIT reason. */
    2676     pSvmTransient->fVectoringPF  = false;                       /* Vectoring page-fault needs to be determined later. */
     2683    pSvmTransient->u64ExitCode  = pVmcb->ctrl.u64ExitCode;      /* Save the #VMEXIT reason. */
     2684    pSvmTransient->fVectoringPF = false;                        /* Vectoring page-fault needs to be determined later. */
    26772685    hmR0SvmSaveGuestState(pVCpu, pMixedCtx);                    /* Save the guest state from the VMCB to the guest-CPU context. */
    26782686
     
    30203028
    30213029        GCPtrPage = Param1.val.val64;
    3022         VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu,  pRegFrame, GCPtrPage);
     3030        VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu, pRegFrame, GCPtrPage);
    30233031        rc = VBOXSTRICTRC_VAL(rc2);
    30243032    }
     
    36083616{
    36093617    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     3618
     3619    Log4(("hmR0SvmExitReadCRx: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip));
     3620
    36103621    /** @todo Decode Assist. */
    36113622    VBOXSTRICTRC rc2 = EMInterpretInstruction(pVCpu, CPUMCTX2CORE(pCtx), 0 /* pvFault */);
     
    37953806    static uint32_t const s_aIOOpAnd[8] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 };  /* AND masks for saving
    37963807                                                                                            the result (in AL/AX/EAX). */
     3808    Log4(("hmR0SvmExitIOInstr: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip));
    37973809
    37983810    PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
     
    40344046    TRPMResetTrap(pVCpu);
    40354047
    4036     Log2(("#NPF: PGMR0Trap0eHandlerNestedPaging returned %Rrc\n",  rc));
     4048    Log4(("#NPF: PGMR0Trap0eHandlerNestedPaging returned %Rrc CS:RIP=%04x:%#RX64\n", rc, pCtx->cs.Sel, pCtx->rip));
    40374049
    40384050    /*
     
    41444156            /* A genuine guest #PF, reflect it to the guest. */
    41454157            hmR0SvmSetPendingXcptPF(pVCpu, pCtx, u32ErrCode, uFaultAddress);
    4146             Log4(("#PF: Guest page fault at %04X:%RGv FaultAddr=%RGv ErrCode=%#x\n", pCtx->cs, (RTGCPTR)pCtx->rip, uFaultAddress,
    4147                   u32ErrCode));
     4158            Log4(("#PF: Guest page fault at %04X:%RGv FaultAddr=%RGv ErrCode=%#x\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip,
     4159                  uFaultAddress, u32ErrCode));
    41484160        }
    41494161        else
     
    41884200#endif
    41894201
    4190     Log4(("#PF: uFaultAddress=%#RX64 cs:rip=%#04x:%#RX64 u32ErrCode %#RX32 cr3=%#RX64\n", uFaultAddress, pCtx->cs.Sel,
     4202    Log4(("#PF: uFaultAddress=%#RX64 CS:RIP=%#04x:%#RX64 u32ErrCode %#RX32 cr3=%#RX64\n", uFaultAddress, pCtx->cs.Sel,
    41914203          pCtx->rip, u32ErrCode, pCtx->cr3));
    41924204
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette