VirtualBox

Changeset 42407 in vbox for trunk/src/recompiler/target-i386


Ignore:
Timestamp:
Jul 26, 2012 11:41:35 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79503
Message:

VMM: Futher work on dealing with hidden segment register, esp. when going stale.

Location:
trunk/src/recompiler/target-i386
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/target-i386/cpu.h

    r38319 r42407  
    6565# include <VBox/vmm/vmm.h>
    6666# include <VBox/vmm/stam.h>
     67# include <VBox/vmm/cpumctx.h>
    6768#endif /* VBOX */
    6869
     
    532533typedef struct SegmentCache {
    533534    uint32_t selector;
     535#ifdef VBOX
     536    /** The new selector is saved here when we are unable to sync it before invoking the recompiled code. */
     537    uint16_t newselector;
     538    uint16_t fVBoxFlags;
     539#endif
    534540    target_ulong base;
    535541    uint32_t limit;
    536542    uint32_t flags;
    537 #ifdef VBOX
    538     /** The new selector is saved here when we are unable to sync it before invoking the recompiled code. */
    539     uint32_t newselector;
    540 #endif
    541543} SegmentCache;
    542544
     
    942944    sc->base = base;
    943945    sc->limit = limit;
     946#ifndef VBOX
    944947    sc->flags = flags;
    945 #ifdef VBOX
     948#else
     949    if (flags & DESC_P_MASK)
     950        flags |= DESC_A_MASK;           /* Make sure the A bit is set to avoid trouble. */
     951    sc->flags = flags;
    946952    sc->newselector = 0;
     953    sc->fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
    947954#endif
    948955
  • trunk/src/recompiler/target-i386/op_helper.c

    r39969 r42407  
    254254    sc->limit = get_seg_limit(e1, e2);
    255255    sc->flags = e2;
     256#ifdef VBOX
     257    sc->newselector = 0;
     258    sc->fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
     259#endif
    256260}
    257261
     
    557561    env->tr.limit = tss_limit;
    558562    env->tr.flags = e2 & ~DESC_TSS_BUSY_MASK;
     563#ifdef VBOX
     564    env->tr.fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
     565    env->tr.newselector = 0;
     566#endif
    559567
    560568    if ((type & 8) && (env->cr[0] & CR0_PG_MASK)) {
     
    596604    env->ldt.limit = 0;
    597605    env->ldt.flags = 0;
     606#ifdef VBOX
     607    env->ldt.fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
     608    env->ldt.newselector = 0;
     609#endif
    598610
    599611    /* load the LDT */
     
    19541966    env->ldt.limit = ldl_phys(sm_state + 0x7e74);
    19551967    env->ldt.flags = (lduw_phys(sm_state + 0x7e72) & 0xf0ff) << 8;
     1968#ifdef VBOX
     1969    env->ldt.fVBoxFlags = CPUMSELREG_FLAGS_VALID;
     1970    env->ldt.newselector = 0;
     1971#endif
    19561972
    19571973    env->idt.base = ldq_phys(sm_state + 0x7e88);
     
    19621978    env->tr.limit = ldl_phys(sm_state + 0x7e94);
    19631979    env->tr.flags = (lduw_phys(sm_state + 0x7e92) & 0xf0ff) << 8;
     1980#ifdef VBOX
     1981    env->tr.fVBoxFlags = CPUMSELREG_FLAGS_VALID;
     1982    env->tr.newselector = 0;
     1983#endif
    19641984
    19651985    EAX = ldq_phys(sm_state + 0x7ff8);
     
    20082028    env->tr.limit = ldl_phys(sm_state + 0x7f60);
    20092029    env->tr.flags = (ldl_phys(sm_state + 0x7f5c) & 0xf0ff) << 8;
     2030#ifdef VBOX
     2031    env->tr.fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
     2032    env->tr.newselector = 0;
     2033#endif
    20102034
    20112035    env->ldt.selector = ldl_phys(sm_state + 0x7fc0) & 0xffff;
     
    20132037    env->ldt.limit = ldl_phys(sm_state + 0x7f7c);
    20142038    env->ldt.flags = (ldl_phys(sm_state + 0x7f78) & 0xf0ff) << 8;
     2039#ifdef VBOX
     2040    env->ldt.fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
     2041    env->ldt.newselector = 0;
     2042#endif
    20152043
    20162044    env->gdt.base = ldl_phys(sm_state + 0x7f74);
     
    24482476        env->ldt.base = 0;
    24492477        env->ldt.limit = 0;
     2478#ifdef VBOX
     2479        env->ldt.fVBoxFlags = CPUMSELREG_FLAGS_VALID;
     2480        env->ldt.newselector = 0;
     2481#endif
    24502482    } else {
    24512483        if (selector & 0x4)
     
    25102542        env->tr.limit = 0;
    25112543        env->tr.flags = 0;
     2544#ifdef VBOX
     2545        env->tr.fVBoxFlags  = CPUMSELREG_FLAGS_VALID;
     2546        env->tr.newselector = 0;
     2547#endif
    25122548    } else {
    25132549        if (selector & 0x4)
     
    57245760
    57255761        /* Successful sync. */
    5726         env1->segs[seg_reg].newselector = 0;
     5762        Assert(env1->segs[seg_reg].newselector == 0);
    57275763    }
    57285764    else
     
    57415777                load_segment(&e1, &e2, selector);
    57425778                cpu_x86_load_seg_cache(env, R_CS, selector,
    5743                                get_seg_base(e1, e2),
    5744                                get_seg_limit(e1, e2),
    5745                                e2);
     5779                                       get_seg_base(e1, e2),
     5780                                       get_seg_limit(e1, e2),
     5781                                       e2);
    57465782            }
    57475783            else
     
    57535789
    57545790            /* Successful sync. */
    5755             env1->segs[seg_reg].newselector = 0;
     5791            Assert(env1->segs[seg_reg].newselector == 0);
    57565792        }
    57575793        else
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