VirtualBox

Ignore:
Timestamp:
Apr 16, 2009 11:41:38 AM (16 years ago)
Author:
vboxsync
Message:

Big step to separate VMM data structures for guest SMP. (pgm, em)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp

    r18876 r18927  
    3737#include "TRPMInternal.h"
    3838#include <VBox/vm.h>
     39#include <VBox/vmm.h>
    3940#include <VBox/param.h>
    4041
     
    134135static int trpmGCExitTrap(PVM pVM, int rc, PCPUMCTXCORE pRegFrame)
    135136{
     137    PVMCPU   pVCpu = VMMGetCpu0(pVM);
    136138    uint32_t uOldActiveVector = pVM->trpm.s.uActiveVector;
    137139    NOREF(uOldActiveVector);
     
    166168    if (VM_FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))
    167169    {
    168         Log2(("VM_FF_INHIBIT_INTERRUPTS at %08RX32 successor %RGv\n", pRegFrame->eip, EMGetInhibitInterruptsPC(pVM)));
    169         if (pRegFrame->eip != EMGetInhibitInterruptsPC(pVM))
     170        Log2(("VM_FF_INHIBIT_INTERRUPTS at %08RX32 successor %RGv\n", pRegFrame->eip, EMGetInhibitInterruptsPC(pVM, pVCpu)));
     171        if (pRegFrame->eip != EMGetInhibitInterruptsPC(pVM, pVCpu))
    170172        {
    171173            /** @note we intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here if the eip is the same as the inhibited instr address.
     
    227229        else if (VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL))
    228230#if 1
    229             rc = PGMSyncCR3(pVM, CPUMGetGuestCR0(pVM), CPUMGetGuestCR3(pVM), CPUMGetGuestCR4(pVM), VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));
     231            rc = PGMSyncCR3(pVM, pVCpu, CPUMGetGuestCR0(pVCpu), CPUMGetGuestCR3(pVCpu), CPUMGetGuestCR4(pVCpu), VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));
    230232#else
    231233            rc = VINF_PGM_SYNC_CR3;
     
    258260{
    259261    RTGCUINTREG uDr6 = ASMGetAndClearDR6();
    260     PVM pVM = TRPM2VM(pTrpm);
     262    PVM         pVM = TRPM2VM(pTrpm);
     263    PVMCPU      pVCpu = VMMGetCpu0(pVM);
     264
    261265    LogFlow(("TRPMGC01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs, pRegFrame->eip, uDr6));
    262266
     
    268272    {
    269273        AssertReleaseMsgFailed(("X86_DR6_BD isn't used, but it's set! dr7=%RTreg(%RTreg) dr6=%RTreg\n",
    270                                 ASMGetDR7(), CPUMGetHyperDR7(pVM), uDr6));
     274                                ASMGetDR7(), CPUMGetHyperDR7(pVCpu), uDr6));
    271275        return VERR_NOT_IMPLEMENTED;
    272276    }
     
    279283    int rc = DBGFGCTrap01Handler(pVM, pRegFrame, uDr6);
    280284    if (rc == VINF_EM_RAW_GUEST_TRAP)
    281         CPUMSetGuestDR6(pVM, uDr6);
     285        CPUMSetGuestDR6(pVCpu, uDr6);
    282286
    283287    rc = trpmGCExitTrap(pVM, rc, pRegFrame);
     
    361365{
    362366    LogFlow(("TRPMGC06: %04x:%08x efl=%x\n", pRegFrame->cs, pRegFrame->eip, pRegFrame->eflags.u32));
    363     PVM pVM = TRPM2VM(pTrpm);
    364     int rc;
    365 
    366     if (CPUMGetGuestCPL(pVM, pRegFrame) == 0)
     367    PVM     pVM = TRPM2VM(pTrpm);
     368    PVMCPU  pVCpu = VMMGetCpu0(pVM);
     369    int     rc;
     370
     371    if (CPUMGetGuestCPL(pVCpu, pRegFrame) == 0)
    367372    {
    368373        /*
     
    381386        DISCPUSTATE Cpu;
    382387        uint32_t    cbOp;
    383         rc = EMInterpretDisasOneEx(pVM, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);
     388        rc = EMInterpretDisasOneEx(pVM, pVCpu, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);
    384389        if (RT_FAILURE(rc))
    385390        {
     
    429434        {
    430435            uint32_t cbIgnored;
    431             rc = EMInterpretInstructionCPU(pVM, &Cpu, pRegFrame, PC, &cbIgnored);
     436            rc = EMInterpretInstructionCPU(pVM, pVCpu, &Cpu, pRegFrame, PC, &cbIgnored);
    432437            if (RT_LIKELY(RT_SUCCESS(rc)))
    433438                pRegFrame->eip += Cpu.opsize;
     
    465470{
    466471    LogFlow(("TRPMGC07: %04x:%08x\n", pRegFrame->cs, pRegFrame->eip));
    467     PVM pVM = TRPM2VM(pTrpm);
    468 
    469     int rc = CPUMHandleLazyFPU(pVM, VMMGetCpu(pVM));
     472    PVM     pVM   = TRPM2VM(pTrpm);
     473    PVMCPU  pVCpu = VMMGetCpu0(pVM);
     474
     475    int rc = CPUMHandleLazyFPU(pVCpu);
    470476    rc = trpmGCExitTrap(pVM, rc, pRegFrame);
    471477    Log6(("TRPMGC07: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs, pRegFrame->eip));
     
    586592static int trpmGCTrap0dHandlerRing0(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR PC)
    587593{
    588     int rc;
     594    int     rc;
     595    PVMCPU  pVCpu = VMMGetCpu0(pVM);
    589596
    590597    /*
     
    661668        {
    662669            uint32_t cbIgnored;
    663             rc = EMInterpretInstructionCPU(pVM, pCpu, pRegFrame, PC, &cbIgnored);
     670            rc = EMInterpretInstructionCPU(pVM, pVCpu, pCpu, pRegFrame, PC, &cbIgnored);
    664671            if (RT_SUCCESS(rc))
    665672                pRegFrame->eip += pCpu->opsize;
     
    688695static int trpmGCTrap0dHandlerRing3(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR PC)
    689696{
    690     int rc;
     697    int     rc;
     698    PVMCPU  pVCpu = VMMGetCpu0(pVM);
    691699
    692700    Assert(!pRegFrame->eflags.Bits.u1VM);
     
    740748        {
    741749            uint32_t cbIgnored;
    742             rc = EMInterpretInstructionCPU(pVM, pCpu, pRegFrame, PC, &cbIgnored);
     750            rc = EMInterpretInstructionCPU(pVM, pVCpu, pCpu, pRegFrame, PC, &cbIgnored);
    743751            if (RT_SUCCESS(rc))
    744752                pRegFrame->eip += pCpu->opsize;
     
    754762        case OP_CLI:
    755763        {
    756             uint32_t efl = CPUMRawGetEFlags(pVM, pRegFrame);
     764            uint32_t efl = CPUMRawGetEFlags(pVCpu, pRegFrame);
    757765            if (X86_EFL_GET_IOPL(efl) >= (unsigned)(pRegFrame->ss & X86_SEL_RPL))
    758766            {
     
    783791DECLINLINE(int) trpmGCTrap0dHandlerRdTsc(PVM pVM, PCPUMCTXCORE pRegFrame)
    784792{
     793    PVMCPU pVCpu = VMMGetCpu0(pVM);
     794
    785795    STAM_COUNTER_INC(&pVM->trpm.s.StatTrap0dRdTsc);
    786796
    787     if (CPUMGetGuestCR4(pVM) & X86_CR4_TSD)
     797    if (CPUMGetGuestCR4(pVCpu) & X86_CR4_TSD)
    788798        return trpmGCExitTrap(pVM, VINF_EM_RAW_EMULATE_INSTR, pRegFrame); /* will trap (optimize later). */
    789799
     
    809819static int trpmGCTrap0dHandler(PVM pVM, PTRPM pTrpm, PCPUMCTXCORE pRegFrame)
    810820{
     821    PVMCPU pVCpu = VMMGetCpu0(pVM);
     822
    811823    LogFlow(("trpmGCTrap0dHandler: cs:eip=%RTsel:%08RX32 uErr=%RGv\n", pRegFrame->ss, pRegFrame->eip, pTrpm->uActiveErrorCode));
    812824
     
    861873        &&  (Cpu.pCurInstr->optype & OPTYPE_PORTIO))
    862874    {
    863         rc = EMInterpretPortIO(pVM, pRegFrame, &Cpu, cbOp);
     875        rc = EMInterpretPortIO(pVM, pVCpu, pRegFrame, &Cpu, cbOp);
    864876        return trpmGCExitTrap(pVM, rc, pRegFrame);
    865877    }
     
    887899     */
    888900    X86EFLAGS eflags;
    889     eflags.u32 = CPUMRawGetEFlags(pVM, pRegFrame); /* Get the correct value. */
     901    eflags.u32 = CPUMRawGetEFlags(pVCpu, pRegFrame); /* Get the correct value. */
    890902    Log3(("TRPM #GP V86: cs:eip=%04x:%08x IOPL=%d efl=%08x\n", pRegFrame->cs, pRegFrame->eip, eflags.Bits.u2IOPL, eflags.u));
    891903    if (eflags.Bits.u2IOPL != 3)
     
    971983{
    972984    LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x\n", pRegFrame->cs, pRegFrame->eip, (uint32_t)pTrpm->uActiveErrorCode, (uint32_t)pTrpm->uActiveCR2));
    973     PVM pVM = TRPM2VM(pTrpm);
     985    PVM     pVM = TRPM2VM(pTrpm);
     986    PVMCPU  pVCpu = VMMGetCpu0(pVM);
    974987
    975988
     
    977990     * This is all PGM stuff.
    978991     */
    979     int rc = PGMTrap0eHandler(pVM, pTrpm->uActiveErrorCode, pRegFrame, (RTGCPTR)pTrpm->uActiveCR2);
     992    int rc = PGMTrap0eHandler(pVM, pVCpu, pTrpm->uActiveErrorCode, pRegFrame, (RTGCPTR)pTrpm->uActiveCR2);
    980993    switch (rc)
    981994    {
     
    12351248
    12361249
    1237         CPUMSetGuestCtxCore(pVM, &CtxCore);
     1250        CPUMSetGuestCtxCore(VMMGetCpu0(pVM), &CtxCore);
    12381251        TRPMGCHyperReturnToHost(pVM, rc);
    12391252    }
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