VirtualBox

Changeset 104511 in vbox


Ignore:
Timestamp:
May 3, 2024 3:03:42 PM (7 months ago)
Author:
vboxsync
Message:

VMM: Some more GCM cleanup. bugref:9735 bugref:10683

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/gcm.h

    r104509 r104511  
    5959#endif /* IN_RING3 */
    6060
    61 VMM_INT_DECL(bool)          GCMShouldTrapXcptDE(PVMCPUCC pVCpu);
    62 VMM_INT_DECL(VBOXSTRICTRC)  GCMXcptDE(PVMCPUCC pVCpu, PCPUMCTX pCtx, PDISSTATE pDis, uint8_t *pcbInstr);
     61VMM_INT_DECL(bool)          GCMIsInterceptingXcptDE(PVMCPUCC pVCpu);
     62VMM_INT_DECL(int)           GCMXcptDE(PVMCPUCC pVCpu, PCPUMCTX pCtx);
    6363/** @} */
    6464
  • trunk/src/VBox/VMM/VMMAll/GCMAll.cpp

    r104509 r104511  
    4747 * @param   pVCpu       The cross context virtual CPU structure.
    4848 */
    49 VMM_INT_DECL(bool) GCMShouldTrapXcptDE(PVMCPUCC pVCpu)
     49VMM_INT_DECL(bool) GCMIsInterceptingXcptDE(PVMCPUCC pVCpu)
    5050{
    51     LogFunc(("GCM checking if #DE needs trapping\n"));
    52     PVM pVM = pVCpu->CTX_SUFF(pVM);
    53 
    5451    /* See if the enabled fixers need to intercept #DE. */
    55     if (  pVM->gcm.s.fFixerSet
    56         & (GCMFIXER_DBZ_DOS | GCMFIXER_DBZ_OS2 | GCMFIXER_DBZ_WIN9X))
    57     {
    58         LogRel(("GCM: #DE should be trapped\n"));
    59         return true;
    60     }
    61 
    62     return false;
     52    PVM const  pVM  = pVCpu->CTX_SUFF(pVM);
     53    bool const fRet = (pVM->gcm.s.fFixerSet & (GCMFIXER_DBZ_DOS | GCMFIXER_DBZ_OS2 | GCMFIXER_DBZ_WIN9X)) != 0;
     54    LogFlow(("GCMIsInterceptingXcptDE: returns %d\n", fRet));
     55    return fRet;
    6356}
    6457
     
    6760 * Exception handler for \#DE when registered by GCM.
    6861 *
    69  * @returns Strict VBox status code.
     62 * @returns VBox status code.
    7063 * @retval  VINF_SUCCESS retry division and continue.
    7164 * @retval  VERR_NOT_FOUND deliver exception to guest.
     
    7366 * @param   pVCpu       The cross context virtual CPU structure.
    7467 * @param   pCtx        Pointer to the guest-CPU context.
    75  * @param   pDis        Pointer to the disassembled instruction state at RIP.
    76  *                      If NULL is passed, it implies the disassembly of the
    77  *                      the instruction at RIP is the
    78  *                      responsibility of GCM.
    79  * @param   pcbInstr    Where to store the instruction length of
    80  *                      the divide instruction. Optional, can be
    81  *                      NULL.
    8268 *
    8369 * @thread  EMT(pVCpu).
    8470 */
    85 VMM_INT_DECL(VBOXSTRICTRC) GCMXcptDE(PVMCPUCC pVCpu, PCPUMCTX pCtx, PDISSTATE pDis, uint8_t *pcbInstr)
     71VMM_INT_DECL(int) GCMXcptDE(PVMCPUCC pVCpu, PCPUMCTX pCtx)
    8672{
    8773    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    8874    Assert(pVM->gcm.s.fFixerSet & (GCMFIXER_DBZ_DOS | GCMFIXER_DBZ_OS2 | GCMFIXER_DBZ_WIN9X));
    89     Assert(pDis || pcbInstr);
    90     RT_NOREF(pDis);
    91     RT_NOREF(pcbInstr);
    9275
    9376    LogRel(("GCM: Intercepted #DE at CS:RIP=%04x:%RX64 (%RX64 linear) RDX:RAX=%RX64:%RX64 RCX=%RX64 RBX=%RX64\n",
     
    214197    return VERR_NOT_FOUND;
    215198}
     199
  • trunk/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h

    r104259 r104511  
    75517551    if (VCPU_2_VMXSTATE(pVCpu).fGCMTrapXcptDE)
    75527552    {
    7553         uint8_t cbInstr = 0;
    7554         VBOXSTRICTRC rc2 = GCMXcptDE(pVCpu, &pVCpu->cpum.GstCtx, NULL /* pDis */, &cbInstr);
    7555         if (rc2 == VINF_SUCCESS)
    7556             rcStrict = VINF_SUCCESS;    /* Restart instruction with modified guest register context. */
    7557         else if (rc2 == VERR_NOT_FOUND)
    7558             rcStrict = VERR_NOT_FOUND;  /* Deliver the exception. */
    7559         else
    7560             Assert(RT_FAILURE(VBOXSTRICTRC_VAL(rcStrict)));
    7561     }
     7553        rcStrict = GCMXcptDE(pVCpu, &pVCpu->cpum.GstCtx);
     7554        Assert(rcStrict == VINF_SUCCESS /* restart instr */ || rcStrict == VERR_NOT_FOUND /* deliver exception */);
     7555    }
     7556    /** @todo r=bird: This cannot be right! It'll suppress \#DE   */
    75627557    else
    75637558        rcStrict = VINF_SUCCESS;        /* Do nothing. */
     
    75717566    }
    75727567
     7568    /** @todo r=bird: This assertion is wrong. rcStrict can never be
     7569     *        VERR_VMX_UNEXPECTED_INTERRUPTION_EXIT_TYPE here, it can only be
     7570     *        VINF_SUCCESS. */
    75737571    Assert(rcStrict == VINF_SUCCESS || rcStrict == VERR_VMX_UNEXPECTED_INTERRUPTION_EXIT_TYPE);
    75747572    return VBOXSTRICTRC_VAL(rcStrict);
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r103194 r104511  
    83598359    {
    83608360        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    8361         uint8_t cbInstr = 0;
    8362         VBOXSTRICTRC rcStrict = GCMXcptDE(pVCpu, &pVCpu->cpum.GstCtx, NULL /* pDis */, &cbInstr);
    8363         if (rcStrict == VINF_SUCCESS)
    8364             rc = VINF_SUCCESS;      /* Restart instruction with modified guest register context. */
    8365         else if (rcStrict == VERR_NOT_FOUND)
    8366             rc = VERR_NOT_FOUND;    /* Deliver the exception. */
    8367         else
    8368             Assert(RT_FAILURE(VBOXSTRICTRC_VAL(rcStrict)));
     8361        rc = GCMXcptDE(pVCpu, &pVCpu->cpum.GstCtx);
     8362        AssertMsg(rc == VINF_SUCCESS /* restart */ || rc == VERR_NOT_FOUND /* deliver exception */, ("rc=%Rrc\n", rc));
    83698363    }
    83708364
  • trunk/src/VBox/VMM/VMMR3/GCM.cpp

    r104508 r104511  
    154154
    155155#if 0 /* development override */
    156     pVM->gcm.s.enmFixerIds = GCMFIXER_DBZ_OS2 | GCMFIXER_DBZ_DOS | GCMFIXER_DBZ_WIN9X;
     156    pVM->gcm.s.fFixerSet = GCMFIXER_DBZ_OS2 | GCMFIXER_DBZ_DOS | GCMFIXER_DBZ_WIN9X;
    157157#endif
    158158
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r103270 r104511  
    754754        PVMCPU pVCpu = pVM->apCpusR3[idCpu];
    755755        pVCpu->hm.s.fActive = false;
    756         pVCpu->hm.s.fGIMTrapXcptUD = GIMShouldTrapXcptUD(pVCpu);    /* Is safe to call now since GIMR3Init() has completed. */
    757         pVCpu->hm.s.fGCMTrapXcptDE = GCMShouldTrapXcptDE(pVCpu);    /* Is safe to call now since GCMR3Init() has completed. */
     756        pVCpu->hm.s.fGIMTrapXcptUD = GIMShouldTrapXcptUD(pVCpu);     /* Is safe to call now since GIMR3Init() has completed. */
     757        pVCpu->hm.s.fGCMTrapXcptDE = GCMIsInterceptingXcptDE(pVCpu); /* Is safe to call now since GCMR3Init() has completed. */
    758758    }
    759759
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