VirtualBox

Changeset 42778 in vbox for trunk/src


Ignore:
Timestamp:
Aug 11, 2012 10:47:03 PM (12 years ago)
Author:
vboxsync
Message:

IEM: CR4 and CR3 fixes. Debugging hacks.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r42777 r42778  
    7575 * context. */
    7676//#define IEM_VERIFICATION_MODE_MINIMAL
     77//#define IEM_LOG_MEMORY_WRITES
    7778
    7879/*******************************************************************************
     
    635636
    636637
    637 #ifdef IEM_VERIFICATION_MODE_MINIMAL
     638#if defined(IEM_VERIFICATION_MODE_MINIMAL) || defined(IEM_LOG_MEMORY_WRITES)
    638639/** What IEM just wrote. */
    639640uint8_t g_abIemWrote[256];
     
    729730    PVMCPU   pVCpu = IEMCPU_TO_VMCPU(pIemCpu);
    730731
    731 #if defined(VBOX_STRICT) && (defined(IEM_VERIFICATION_MODE_FULL) || defined(VBOX_WITH_RAW_MODE_NOT_R0))
     732#if defined(VBOX_STRICT) && (defined(IEM_VERIFICATION_MODE_FULL) || !defined(VBOX_WITH_RAW_MODE_NOT_R0))
    732733    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx->cs));
    733734    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx->ss));
     
    47374738    /* Force the alternative path so we can ignore writes. */
    47384739    if ((fAccess & IEM_ACCESS_TYPE_WRITE) && !pIemCpu->fNoRem)
     4740        return VERR_PGM_PHYS_TLB_CATCH_ALL;
     4741#endif
     4742#ifdef IEM_LOG_MEMORY_WRITES
     4743    if (fAccess & IEM_ACCESS_TYPE_WRITE)
    47394744        return VERR_PGM_PHYS_TLB_CATCH_ALL;
    47404745#endif
     
    49244929    }
    49254930#endif
    4926 #ifdef IEM_VERIFICATION_MODE_MINIMAL
     4931#if defined(IEM_VERIFICATION_MODE_MINIMAL) || defined(IEM_LOG_MEMORY_WRITES)
    49274932    if (rc == VINF_SUCCESS)
    49284933    {
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r42777 r42778  
    27962796    if (rcStrict == VINF_SUCCESS)
    27972797    {
    2798         if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     2798        if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    27992799            rcStrict = CPUMSetGuestGDTR(IEMCPU_TO_VMCPU(pIemCpu), GCPtrBase, cbLimit);
    28002800        else
     
    28542854    if (rcStrict == VINF_SUCCESS)
    28552855    {
    2856         if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     2856        if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    28572857            CPUMSetGuestIDTR(IEMCPU_TO_VMCPU(pIemCpu), GCPtrBase, cbLimit);
    28582858        else
     
    29242924    {
    29252925        Log(("lldt %04x: Loading NULL selector.\n",  uNewLdt));
    2926         if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     2926        if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    29272927            CPUMSetGuestLDTR(IEMCPU_TO_VMCPU(pIemCpu), uNewLdt);
    29282928        else
     
    29912991     */
    29922992/** @todo check if the actual value is loaded or if the RPL is dropped */
    2993     if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     2993    if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    29942994        CPUMSetGuestLDTR(IEMCPU_TO_VMCPU(pIemCpu), uNewLdt & X86_SEL_MASK_OFF_RPL);
    29952995    else
     
    31123112     */
    31133113/** @todo check if the actual value is loaded or if the RPL is dropped */
    3114     if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3114    if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    31153115        CPUMSetGuestTR(IEMCPU_TO_VMCPU(pIemCpu), uNewTr & X86_SEL_MASK_OFF_RPL);
    31163116    else
     
    31493149        case 4: crX = pCtx->cr4; break;
    31503150        case 8:
    3151             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3151            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    31523152                IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Implement CR8/TPR read\n")); /** @todo implement CR8 reading and writing. */
    31533153            else
     
    32603260                    NewEFER &= ~MSR_K6_EFER_LME;
    32613261
    3262                 if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3262                if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    32633263                    CPUMSetGuestEFER(pVCpu, NewEFER);
    32643264                else
     
    32703270             * Inform PGM.
    32713271             */
    3272             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3272            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    32733273            {
    32743274                if (    (uNewCrX & (X86_CR0_PG | X86_CR0_WP | X86_CR0_PE))
     
    33373337
    33383338            /* Make the change. */
    3339             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3339            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    33403340            {
    33413341                rc = CPUMSetGuestCR3(pVCpu, uNewCrX);
     
    33463346
    33473347            /* Inform PGM. */
    3348             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3348            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    33493349            {
    33503350                if (pCtx->cr0 & X86_CR0_PG)
    33513351                {
    3352                     rc = PGMFlushTLB(pVCpu, pCtx->cr3, !(pCtx->cr3 & X86_CR4_PGE));
     3352                    rc = PGMFlushTLB(pVCpu, pCtx->cr3, !(pCtx->cr4 & X86_CR4_PGE));
    33533353                    AssertRCReturn(rc, rc);
    33543354                    /* ignore informational status codes */
     
    33973397             * Change it.
    33983398             */
    3399             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3399            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    34003400            {
    34013401                rc = CPUMSetGuestCR4(pVCpu, uNewCrX);
     
    34093409             * Notify SELM and PGM.
    34103410             */
    3411             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3411            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    34123412            {
    34133413                /* SELM - VME may change things wrt to the TSS shadowing. */
     
    34203420
    34213421                /* PGM - flushing and mode. */
    3422                 if (    (uNewCrX & (X86_CR0_PG | X86_CR0_WP | X86_CR0_PE))
    3423                     !=  (uOldCrX & (X86_CR0_PG | X86_CR0_WP | X86_CR0_PE)) )
     3422                if ((uNewCrX ^ uOldCrX) & (X86_CR4_PSE | X86_CR4_PAE | X86_CR4_PGE))
    34243423                {
    34253424                    rc = PGMFlushTLB(pVCpu, pCtx->cr3, true /* global */);
     
    34383437         */
    34393438        case 8:
    3440             if (!IEM_VERIFICATION_ENABLED(pIemCpu))
     3439            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    34413440                IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Implement CR8/TPR read\n")); /** @todo implement CR8 reading and writing. */
    34423441            else
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r42777 r42778  
    480480#endif
    481481
     482/**
     483 * Tests if full verification mode is enabled.
     484 *
     485 * This expands to @c false when IEM_VERIFICATION_MODE is not defined and
     486 * should therefore cause the compiler to eliminate the verification branch
     487 * of an if statement.  */
     488#ifdef IEM_VERIFICATION_MODE_FULL
     489# define IEM_FULL_VERIFICATION_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem)
     490#else
     491# define IEM_FULL_VERIFICATION_ENABLED(a_pIemCpu) (false)
     492#endif
     493
    482494/** @def IEM_VERIFICATION_MODE
    483495 * Indicates that one of the verfication modes are enabled.
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