VirtualBox

Changeset 41906 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jun 24, 2012 3:44:03 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78759
Message:

CPUM: Combined the visible and hidden selector register data into one structure. Preparing for lazily resolving+caching of hidden registers in raw-mode.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r41905 r41906  
    176176    SSMFIELD_ENTRY(         CPUMCTX, rsp),
    177177    SSMFIELD_ENTRY_OLD(              lss_esp, sizeof(uint32_t)),
    178     SSMFIELD_ENTRY(         CPUMCTX, ss),
     178    SSMFIELD_ENTRY(         CPUMCTX, ss.Sel),
    179179    SSMFIELD_ENTRY_OLD(              ssPadding, sizeof(uint16_t)),
    180     SSMFIELD_ENTRY(         CPUMCTX, gs),
     180    SSMFIELD_ENTRY(         CPUMCTX, gs.Sel),
    181181    SSMFIELD_ENTRY_OLD(              gsPadding, sizeof(uint16_t)),
    182     SSMFIELD_ENTRY(         CPUMCTX, fs),
     182    SSMFIELD_ENTRY(         CPUMCTX, fs.Sel),
    183183    SSMFIELD_ENTRY_OLD(              fsPadding, sizeof(uint16_t)),
    184     SSMFIELD_ENTRY(         CPUMCTX, es),
     184    SSMFIELD_ENTRY(         CPUMCTX, es.Sel),
    185185    SSMFIELD_ENTRY_OLD(              esPadding, sizeof(uint16_t)),
    186     SSMFIELD_ENTRY(         CPUMCTX, ds),
     186    SSMFIELD_ENTRY(         CPUMCTX, ds.Sel),
    187187    SSMFIELD_ENTRY_OLD(              dsPadding, sizeof(uint16_t)),
    188     SSMFIELD_ENTRY(         CPUMCTX, cs),
     188    SSMFIELD_ENTRY(         CPUMCTX, cs.Sel),
    189189    SSMFIELD_ENTRY_OLD(              csPadding, sizeof(uint16_t)*3),
    190190    SSMFIELD_ENTRY(         CPUMCTX, rflags),
     
    198198    SSMFIELD_ENTRY(         CPUMCTX, r14),
    199199    SSMFIELD_ENTRY(         CPUMCTX, r15),
    200     SSMFIELD_ENTRY(         CPUMCTX, esHid.u64Base),
    201     SSMFIELD_ENTRY(         CPUMCTX, esHid.u32Limit),
    202     SSMFIELD_ENTRY(         CPUMCTX, esHid.Attr),
    203     SSMFIELD_ENTRY(         CPUMCTX, csHid.u64Base),
    204     SSMFIELD_ENTRY(         CPUMCTX, csHid.u32Limit),
    205     SSMFIELD_ENTRY(         CPUMCTX, csHid.Attr),
    206     SSMFIELD_ENTRY(         CPUMCTX, ssHid.u64Base),
    207     SSMFIELD_ENTRY(         CPUMCTX, ssHid.u32Limit),
    208     SSMFIELD_ENTRY(         CPUMCTX, ssHid.Attr),
    209     SSMFIELD_ENTRY(         CPUMCTX, dsHid.u64Base),
    210     SSMFIELD_ENTRY(         CPUMCTX, dsHid.u32Limit),
    211     SSMFIELD_ENTRY(         CPUMCTX, dsHid.Attr),
    212     SSMFIELD_ENTRY(         CPUMCTX, fsHid.u64Base),
    213     SSMFIELD_ENTRY(         CPUMCTX, fsHid.u32Limit),
    214     SSMFIELD_ENTRY(         CPUMCTX, fsHid.Attr),
    215     SSMFIELD_ENTRY(         CPUMCTX, gsHid.u64Base),
    216     SSMFIELD_ENTRY(         CPUMCTX, gsHid.u32Limit),
    217     SSMFIELD_ENTRY(         CPUMCTX, gsHid.Attr),
     200    SSMFIELD_ENTRY(         CPUMCTX, es.u64Base),
     201    SSMFIELD_ENTRY(         CPUMCTX, es.u32Limit),
     202    SSMFIELD_ENTRY(         CPUMCTX, es.Attr),
     203    SSMFIELD_ENTRY(         CPUMCTX, cs.u64Base),
     204    SSMFIELD_ENTRY(         CPUMCTX, cs.u32Limit),
     205    SSMFIELD_ENTRY(         CPUMCTX, cs.Attr),
     206    SSMFIELD_ENTRY(         CPUMCTX, ss.u64Base),
     207    SSMFIELD_ENTRY(         CPUMCTX, ss.u32Limit),
     208    SSMFIELD_ENTRY(         CPUMCTX, ss.Attr),
     209    SSMFIELD_ENTRY(         CPUMCTX, ds.u64Base),
     210    SSMFIELD_ENTRY(         CPUMCTX, ds.u32Limit),
     211    SSMFIELD_ENTRY(         CPUMCTX, ds.Attr),
     212    SSMFIELD_ENTRY(         CPUMCTX, fs.u64Base),
     213    SSMFIELD_ENTRY(         CPUMCTX, fs.u32Limit),
     214    SSMFIELD_ENTRY(         CPUMCTX, fs.Attr),
     215    SSMFIELD_ENTRY(         CPUMCTX, gs.u64Base),
     216    SSMFIELD_ENTRY(         CPUMCTX, gs.u32Limit),
     217    SSMFIELD_ENTRY(         CPUMCTX, gs.Attr),
    218218    SSMFIELD_ENTRY(         CPUMCTX, cr0),
    219219    SSMFIELD_ENTRY(         CPUMCTX, cr2),
     
    234234    SSMFIELD_ENTRY(         CPUMCTX, idtr.pIdt),
    235235    SSMFIELD_ENTRY_OLD(              idtrPadding, sizeof(uint16_t)),
    236     SSMFIELD_ENTRY(         CPUMCTX, ldtr),
     236    SSMFIELD_ENTRY(         CPUMCTX, ldtr.Sel),
    237237    SSMFIELD_ENTRY_OLD(              ldtrPadding, sizeof(uint16_t)),
    238     SSMFIELD_ENTRY(         CPUMCTX, tr),
     238    SSMFIELD_ENTRY(         CPUMCTX, tr.Sel),
    239239    SSMFIELD_ENTRY_OLD(              trPadding, sizeof(uint16_t)),
    240240    SSMFIELD_ENTRY(         CPUMCTX, SysEnter.cs),
     
    248248    SSMFIELD_ENTRY(         CPUMCTX, msrSFMASK),
    249249    SSMFIELD_ENTRY(         CPUMCTX, msrKERNELGSBASE),
    250     SSMFIELD_ENTRY(         CPUMCTX, ldtrHid.u64Base),
    251     SSMFIELD_ENTRY(         CPUMCTX, ldtrHid.u32Limit),
    252     SSMFIELD_ENTRY(         CPUMCTX, ldtrHid.Attr),
    253     SSMFIELD_ENTRY(         CPUMCTX, trHid.u64Base),
    254     SSMFIELD_ENTRY(         CPUMCTX, trHid.u32Limit),
    255     SSMFIELD_ENTRY(         CPUMCTX, trHid.Attr),
     250    SSMFIELD_ENTRY(         CPUMCTX, ldtr.u64Base),
     251    SSMFIELD_ENTRY(         CPUMCTX, ldtr.u32Limit),
     252    SSMFIELD_ENTRY(         CPUMCTX, ldtr.Attr),
     253    SSMFIELD_ENTRY(         CPUMCTX, tr.u64Base),
     254    SSMFIELD_ENTRY(         CPUMCTX, tr.u32Limit),
     255    SSMFIELD_ENTRY(         CPUMCTX, tr.Attr),
    256256    SSMFIELD_ENTRY_TERM()
    257257};
     
    305305    SSMFIELD_ENTRY(             CPUMCTX, rcx),
    306306    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, rsp),
    307     SSMFIELD_ENTRY(             CPUMCTX, ss),
     307    SSMFIELD_ENTRY(             CPUMCTX, ss.Sel),
    308308    SSMFIELD_ENTRY_OLD(                  ssPadding, sizeof(uint16_t)),
    309309    SSMFIELD_ENTRY_OLD(         CPUMCTX, sizeof(uint64_t) /*rsp_notused*/),
    310     SSMFIELD_ENTRY(             CPUMCTX, gs),
     310    SSMFIELD_ENTRY(             CPUMCTX, gs.Sel),
    311311    SSMFIELD_ENTRY_OLD(                  gsPadding, sizeof(uint16_t)),
    312     SSMFIELD_ENTRY(             CPUMCTX, fs),
     312    SSMFIELD_ENTRY(             CPUMCTX, fs.Sel),
    313313    SSMFIELD_ENTRY_OLD(                  fsPadding, sizeof(uint16_t)),
    314     SSMFIELD_ENTRY(             CPUMCTX, es),
     314    SSMFIELD_ENTRY(             CPUMCTX, es.Sel),
    315315    SSMFIELD_ENTRY_OLD(                  esPadding, sizeof(uint16_t)),
    316     SSMFIELD_ENTRY(             CPUMCTX, ds),
     316    SSMFIELD_ENTRY(             CPUMCTX, ds.Sel),
    317317    SSMFIELD_ENTRY_OLD(                  dsPadding, sizeof(uint16_t)),
    318     SSMFIELD_ENTRY(             CPUMCTX, cs),
     318    SSMFIELD_ENTRY(             CPUMCTX, cs.Sel),
    319319    SSMFIELD_ENTRY_OLD(                  csPadding, sizeof(uint16_t)*3),
    320320    SSMFIELD_ENTRY(             CPUMCTX, rflags),
     
    328328    SSMFIELD_ENTRY(             CPUMCTX, r14),
    329329    SSMFIELD_ENTRY(             CPUMCTX, r15),
    330     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, esHid.u64Base),
    331     SSMFIELD_ENTRY(             CPUMCTX, esHid.u32Limit),
    332     SSMFIELD_ENTRY(             CPUMCTX, esHid.Attr),
    333     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, csHid.u64Base),
    334     SSMFIELD_ENTRY(             CPUMCTX, csHid.u32Limit),
    335     SSMFIELD_ENTRY(             CPUMCTX, csHid.Attr),
    336     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, ssHid.u64Base),
    337     SSMFIELD_ENTRY(             CPUMCTX, ssHid.u32Limit),
    338     SSMFIELD_ENTRY(             CPUMCTX, ssHid.Attr),
    339     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, dsHid.u64Base),
    340     SSMFIELD_ENTRY(             CPUMCTX, dsHid.u32Limit),
    341     SSMFIELD_ENTRY(             CPUMCTX, dsHid.Attr),
    342     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, fsHid.u64Base),
    343     SSMFIELD_ENTRY(             CPUMCTX, fsHid.u32Limit),
    344     SSMFIELD_ENTRY(             CPUMCTX, fsHid.Attr),
    345     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, gsHid.u64Base),
    346     SSMFIELD_ENTRY(             CPUMCTX, gsHid.u32Limit),
    347     SSMFIELD_ENTRY(             CPUMCTX, gsHid.Attr),
     330    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, es.u64Base),
     331    SSMFIELD_ENTRY(             CPUMCTX, es.u32Limit),
     332    SSMFIELD_ENTRY(             CPUMCTX, es.Attr),
     333    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, cs.u64Base),
     334    SSMFIELD_ENTRY(             CPUMCTX, cs.u32Limit),
     335    SSMFIELD_ENTRY(             CPUMCTX, cs.Attr),
     336    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, ss.u64Base),
     337    SSMFIELD_ENTRY(             CPUMCTX, ss.u32Limit),
     338    SSMFIELD_ENTRY(             CPUMCTX, ss.Attr),
     339    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, ds.u64Base),
     340    SSMFIELD_ENTRY(             CPUMCTX, ds.u32Limit),
     341    SSMFIELD_ENTRY(             CPUMCTX, ds.Attr),
     342    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, fs.u64Base),
     343    SSMFIELD_ENTRY(             CPUMCTX, fs.u32Limit),
     344    SSMFIELD_ENTRY(             CPUMCTX, fs.Attr),
     345    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, gs.u64Base),
     346    SSMFIELD_ENTRY(             CPUMCTX, gs.u32Limit),
     347    SSMFIELD_ENTRY(             CPUMCTX, gs.Attr),
    348348    SSMFIELD_ENTRY(             CPUMCTX, cr0),
    349349    SSMFIELD_ENTRY(             CPUMCTX, cr2),
     
    367367    SSMFIELD_ENTRY_OLD(                  idtrPadding, sizeof(uint16_t)),
    368368    SSMFIELD_ENTRY_OLD(                  idtrPadding64, sizeof(uint64_t)),
    369     SSMFIELD_ENTRY(             CPUMCTX, ldtr),
     369    SSMFIELD_ENTRY(             CPUMCTX, ldtr.Sel),
    370370    SSMFIELD_ENTRY_OLD(                  ldtrPadding, sizeof(uint16_t)),
    371     SSMFIELD_ENTRY(             CPUMCTX, tr),
     371    SSMFIELD_ENTRY(             CPUMCTX, tr.Sel),
    372372    SSMFIELD_ENTRY_OLD(                  trPadding, sizeof(uint16_t)),
    373373    SSMFIELD_ENTRY(             CPUMCTX, SysEnter.cs),
     
    383383    SSMFIELD_ENTRY_OLD(                  msrGSBASE, sizeof(uint64_t)),
    384384    SSMFIELD_ENTRY(             CPUMCTX, msrKERNELGSBASE),
    385     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, ldtrHid.u64Base),
    386     SSMFIELD_ENTRY(             CPUMCTX, ldtrHid.u32Limit),
    387     SSMFIELD_ENTRY(             CPUMCTX, ldtrHid.Attr),
    388     SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, trHid.u64Base),
    389     SSMFIELD_ENTRY(             CPUMCTX, trHid.u32Limit),
    390     SSMFIELD_ENTRY(             CPUMCTX, trHid.Attr),
     385    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, ldtr.u64Base),
     386    SSMFIELD_ENTRY(             CPUMCTX, ldtr.u32Limit),
     387    SSMFIELD_ENTRY(             CPUMCTX, ldtr.Attr),
     388    SSMFIELD_ENTRY_U32_ZX_U64(  CPUMCTX, tr.u64Base),
     389    SSMFIELD_ENTRY(             CPUMCTX, tr.u32Limit),
     390    SSMFIELD_ENTRY(             CPUMCTX, tr.Attr),
    391391    SSMFIELD_ENTRY_OLD(                  padding, sizeof(uint32_t)*2),
    392392    SSMFIELD_ENTRY_TERM()
     
    13581358    pCtx->eflags.Bits.u1Reserved0   = 1;
    13591359
    1360     pCtx->cs                        = 0xf000;
    1361     pCtx->csHid.u64Base             = UINT64_C(0xffff0000);
    1362     pCtx->csHid.u32Limit            = 0x0000ffff;
    1363     pCtx->csHid.Attr.n.u1DescType   = 1; /* code/data segment */
    1364     pCtx->csHid.Attr.n.u1Present    = 1;
    1365     pCtx->csHid.Attr.n.u4Type       = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE;
    1366 
    1367     pCtx->dsHid.u32Limit            = 0x0000ffff;
    1368     pCtx->dsHid.Attr.n.u1DescType   = 1; /* code/data segment */
    1369     pCtx->dsHid.Attr.n.u1Present    = 1;
    1370     pCtx->dsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    1371 
    1372     pCtx->esHid.u32Limit            = 0x0000ffff;
    1373     pCtx->esHid.Attr.n.u1DescType   = 1; /* code/data segment */
    1374     pCtx->esHid.Attr.n.u1Present    = 1;
    1375     pCtx->esHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    1376 
    1377     pCtx->fsHid.u32Limit            = 0x0000ffff;
    1378     pCtx->fsHid.Attr.n.u1DescType   = 1; /* code/data segment */
    1379     pCtx->fsHid.Attr.n.u1Present    = 1;
    1380     pCtx->fsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    1381 
    1382     pCtx->gsHid.u32Limit            = 0x0000ffff;
    1383     pCtx->gsHid.Attr.n.u1DescType   = 1; /* code/data segment */
    1384     pCtx->gsHid.Attr.n.u1Present    = 1;
    1385     pCtx->gsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    1386 
    1387     pCtx->ssHid.u32Limit            = 0x0000ffff;
    1388     pCtx->ssHid.Attr.n.u1Present    = 1;
    1389     pCtx->ssHid.Attr.n.u1DescType   = 1; /* code/data segment */
    1390     pCtx->ssHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
     1360    pCtx->cs.Sel                    = 0xf000;
     1361    pCtx->cs.ValidSel               = 0xf000;
     1362    pCtx->cs.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1363    pCtx->cs.u64Base                = UINT64_C(0xffff0000);
     1364    pCtx->cs.u32Limit               = 0x0000ffff;
     1365    pCtx->cs.Attr.n.u1DescType      = 1; /* code/data segment */
     1366    pCtx->cs.Attr.n.u1Present       = 1;
     1367    pCtx->cs.Attr.n.u4Type          = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE;
     1368
     1369    pCtx->ds.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1370    pCtx->ds.u32Limit               = 0x0000ffff;
     1371    pCtx->ds.Attr.n.u1DescType      = 1; /* code/data segment */
     1372    pCtx->ds.Attr.n.u1Present       = 1;
     1373    pCtx->ds.Attr.n.u4Type          = X86_SEL_TYPE_RW;
     1374
     1375    pCtx->es.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1376    pCtx->es.u32Limit               = 0x0000ffff;
     1377    pCtx->es.Attr.n.u1DescType      = 1; /* code/data segment */
     1378    pCtx->es.Attr.n.u1Present       = 1;
     1379    pCtx->es.Attr.n.u4Type          = X86_SEL_TYPE_RW;
     1380
     1381    pCtx->fs.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1382    pCtx->fs.u32Limit               = 0x0000ffff;
     1383    pCtx->fs.Attr.n.u1DescType      = 1; /* code/data segment */
     1384    pCtx->fs.Attr.n.u1Present       = 1;
     1385    pCtx->fs.Attr.n.u4Type          = X86_SEL_TYPE_RW;
     1386
     1387    pCtx->gs.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1388    pCtx->gs.u32Limit               = 0x0000ffff;
     1389    pCtx->gs.Attr.n.u1DescType      = 1; /* code/data segment */
     1390    pCtx->gs.Attr.n.u1Present       = 1;
     1391    pCtx->gs.Attr.n.u4Type          = X86_SEL_TYPE_RW;
     1392
     1393    pCtx->ss.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1394    pCtx->ss.u32Limit               = 0x0000ffff;
     1395    pCtx->ss.Attr.n.u1Present       = 1;
     1396    pCtx->ss.Attr.n.u1DescType      = 1; /* code/data segment */
     1397    pCtx->ss.Attr.n.u4Type          = X86_SEL_TYPE_RW;
    13911398
    13921399    pCtx->idtr.cbIdt                = 0xffff;
    13931400    pCtx->gdtr.cbGdt                = 0xffff;
    13941401
    1395     pCtx->ldtrHid.u32Limit          = 0xffff;
    1396     pCtx->ldtrHid.Attr.n.u1Present  = 1;
    1397     pCtx->ldtrHid.Attr.n.u4Type     = X86_SEL_TYPE_SYS_LDT;
    1398 
    1399     pCtx->trHid.u32Limit            = 0xffff;
    1400     pCtx->trHid.Attr.n.u1Present    = 1;
    1401     pCtx->trHid.Attr.n.u4Type       = X86_SEL_TYPE_SYS_386_TSS_BUSY;    /* Deduction, not properly documented by Intel. */
     1402    pCtx->ldtr.fFlags               = CPUMSELREG_FLAGS_VALID;
     1403    pCtx->ldtr.u32Limit             = 0xffff;
     1404    pCtx->ldtr.Attr.n.u1Present     = 1;
     1405    pCtx->ldtr.Attr.n.u4Type        = X86_SEL_TYPE_SYS_LDT;
     1406
     1407    pCtx->tr.fFlags                 = CPUMSELREG_FLAGS_VALID;
     1408    pCtx->tr.u32Limit               = 0xffff;
     1409    pCtx->tr.Attr.n.u1Present       = 1;
     1410    pCtx->tr.Attr.n.u4Type          = X86_SEL_TYPE_SYS_386_TSS_BUSY;    /* Deduction, not properly documented by Intel. */
    14021411
    14031412    pCtx->dr[6]                     = X86_DR6_INIT_VAL;
     
    26142623                    pszPrefix, pCtxCore->r14, pszPrefix, pCtxCore->r15,
    26152624                    pszPrefix, pCtxCore->rip, pszPrefix, pCtxCore->rsp, pszPrefix, pCtxCore->rbp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
    2616                     pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,
    2617                     pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, efl);
     2625                    pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel,
     2626                    pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, efl);
    26182627            else
    26192628                pHlp->pfnPrintf(pHlp,
     
    26232632                    pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi,
    26242633                    pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
    2625                     pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,
    2626                     pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, efl);
     2634                    pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel,
     2635                    pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, efl);
    26272636            break;
    26282637
     
    26422651                    pszPrefix, pCtxCore->r14, pszPrefix, pCtxCore->r15,
    26432652                    pszPrefix, pCtxCore->rip, pszPrefix, pCtxCore->rsp, pszPrefix, pCtxCore->rbp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
    2644                     pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,
    2645                     pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, (RTSEL)pCtx->tr, pszPrefix, efl,
     2653                    pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel,
     2654                    pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, pCtx->tr.Sel, pszPrefix, efl,
    26462655                    pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4,
    2647                     pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, (RTSEL)pCtx->ldtr);
     2656                    pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->ldtr.Sel);
    26482657            else
    26492658                pHlp->pfnPrintf(pHlp,
     
    26552664                    pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi,
    26562665                    pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
    2657                     pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,
    2658                     pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, (RTSEL)pCtx->tr, pszPrefix, efl,
     2666                    pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel,
     2667                    pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, pCtx->tr.Sel, pszPrefix, efl,
    26592668                    pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4,
    2660                     pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, (RTSEL)pCtx->ldtr);
     2669                    pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->ldtr.Sel);
    26612670            break;
    26622671
     
    26872696                    pszPrefix, pCtxCore->r14, pszPrefix, pCtxCore->r15,
    26882697                    pszPrefix, pCtxCore->rip, pszPrefix, pCtxCore->rsp, pszPrefix, pCtxCore->rbp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
    2689                     pszPrefix, (RTSEL)pCtxCore->cs, pCtx->csHid.u64Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u,
    2690                     pszPrefix, (RTSEL)pCtxCore->ds, pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u,
    2691                     pszPrefix, (RTSEL)pCtxCore->es, pCtx->esHid.u64Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u,
    2692                     pszPrefix, (RTSEL)pCtxCore->fs, pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u,
    2693                     pszPrefix, (RTSEL)pCtxCore->gs, pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u,
    2694                     pszPrefix, (RTSEL)pCtxCore->ss, pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u,
     2698                    pszPrefix, pCtxCore->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u,
     2699                    pszPrefix, pCtxCore->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u,
     2700                    pszPrefix, pCtxCore->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u,
     2701                    pszPrefix, pCtxCore->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u,
     2702                    pszPrefix, pCtxCore->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u,
     2703                    pszPrefix, pCtxCore->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u,
    26952704                    pszPrefix, pCtx->cr0,  pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3,  pszPrefix, pCtx->cr4,
    26962705                    pszPrefix, pCtx->dr[0],  pszPrefix, pCtx->dr[1], pszPrefix, pCtx->dr[2],  pszPrefix, pCtx->dr[3],
    26972706                    pszPrefix, pCtx->dr[4],  pszPrefix, pCtx->dr[5], pszPrefix, pCtx->dr[6],  pszPrefix, pCtx->dr[7],
    26982707                    pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, pszPrefix, efl,
    2699                     pszPrefix, (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u64Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,
    2700                     pszPrefix, (RTSEL)pCtx->tr, pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,
     2708                    pszPrefix, pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u,
     2709                    pszPrefix, pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u,
    27012710                    pszPrefix, pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp);
    27022711            else
     
    27172726                    pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi,
    27182727                    pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
    2719                     pszPrefix, (RTSEL)pCtxCore->cs, pCtx->csHid.u64Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u, pszPrefix, pCtx->dr[0],  pszPrefix, pCtx->dr[1],
    2720                     pszPrefix, (RTSEL)pCtxCore->ds, pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u, pszPrefix, pCtx->dr[2],  pszPrefix, pCtx->dr[3],
    2721                     pszPrefix, (RTSEL)pCtxCore->es, pCtx->esHid.u64Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u, pszPrefix, pCtx->dr[4],  pszPrefix, pCtx->dr[5],
    2722                     pszPrefix, (RTSEL)pCtxCore->fs, pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u, pszPrefix, pCtx->dr[6],  pszPrefix, pCtx->dr[7],
    2723                     pszPrefix, (RTSEL)pCtxCore->gs, pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u, pszPrefix, pCtx->cr0,  pszPrefix, pCtx->cr2,
    2724                     pszPrefix, (RTSEL)pCtxCore->ss, pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u, pszPrefix, pCtx->cr3,  pszPrefix, pCtx->cr4,
     2728                    pszPrefix, pCtxCore->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u, pszPrefix, pCtx->dr[0],  pszPrefix, pCtx->dr[1],
     2729                    pszPrefix, pCtxCore->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u, pszPrefix, pCtx->dr[2],  pszPrefix, pCtx->dr[3],
     2730                    pszPrefix, pCtxCore->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u, pszPrefix, pCtx->dr[4],  pszPrefix, pCtx->dr[5],
     2731                    pszPrefix, pCtxCore->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u, pszPrefix, pCtx->dr[6],  pszPrefix, pCtx->dr[7],
     2732                    pszPrefix, pCtxCore->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u, pszPrefix, pCtx->cr0,  pszPrefix, pCtx->cr2,
     2733                    pszPrefix, pCtxCore->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u, pszPrefix, pCtx->cr3,  pszPrefix, pCtx->cr4,
    27252734                    pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, pszPrefix, efl,
    2726                     pszPrefix, (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u64Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,
    2727                     pszPrefix, (RTSEL)pCtx->tr, pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,
     2735                    pszPrefix, pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u,
     2736                    pszPrefix, pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u,
    27282737                    pszPrefix, pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp);
    27292738
     
    29642973            /*pCtx->eax,*/ pCtx->ebx, /*pCtx->ecx, pCtx->edx,*/ pCtx->esi, pCtx->edi,
    29652974            /*pCtx->eip,*/ pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(efl), szEFlags,
    2966             (RTSEL)pCtx->cs, (RTSEL)pCtx->ds, (RTSEL)pCtx->es, (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, efl,
     2975            pCtx->cs, pCtx->ds, pCtx->es, pCtx->fs, pCtx->gs, efl,
    29672976            pCtx->cr0, /*pCtx->cr2,*/ pCtx->cr3, pCtx->cr4,
    29682977            pCtx->dr0, pCtx->dr1, pCtx->dr2, pCtx->dr3, pCtx->dr6, pCtx->dr7,
    2969             (uint32_t)pCtx->gdtr.uAddr, pCtx->gdtr.cb, (RTSEL)pCtx->ldtr,
     2978            (uint32_t)pCtx->gdtr.uAddr, pCtx->gdtr.cb, pCtx->ldtr,
    29702979            pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp);
    29712980    }
     
    30003009            pCtx->r14, pCtx->r15,
    30013010            X86_EFL_GET_IOPL(efl), szEFlags,
    3002             (RTSEL)pCtx->cs, (RTSEL)pCtx->ds, (RTSEL)pCtx->es, (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, efl,
     3011            pCtx->cs, pCtx->ds, pCtx->es, pCtx->fs, pCtx->gs, efl,
    30033012            pCtx->cr0, /*pCtx->cr2,*/ pCtx->cr3,
    30043013            pCtx->cr4, pCtx->ldtr, pCtx->tr,
     
    38273836        if (CPUMAreHiddenSelRegsValid(pVCpu))
    38283837        {
    3829             State.f64Bits         = enmMode >= PGMMODE_AMD64 && pCtx->csHid.Attr.n.u1Long;
    3830             State.GCPtrSegBase    = pCtx->csHid.u64Base;
    3831             State.GCPtrSegEnd     = pCtx->csHid.u32Limit + 1 + (RTGCUINTPTR)pCtx->csHid.u64Base;
    3832             State.cbSegLimit      = pCtx->csHid.u32Limit;
     3838            State.f64Bits         = enmMode >= PGMMODE_AMD64 && pCtx->cs.Attr.n.u1Long;
     3839            State.GCPtrSegBase    = pCtx->cs.u64Base;
     3840            State.GCPtrSegEnd     = pCtx->cs.u32Limit + 1 + (RTGCUINTPTR)pCtx->cs.u64Base;
     3841            State.cbSegLimit      = pCtx->cs.u32Limit;
    38333842            enmDisCpuMode         = (State.f64Bits)
    38343843                                    ? DISCPUMODE_64BIT
    3835                                     : pCtx->csHid.Attr.n.u1DefBig
     3844                                    : pCtx->cs.Attr.n.u1DefBig
    38363845                                    ? DISCPUMODE_32BIT
    38373846                                    : DISCPUMODE_16BIT;
     
    38413850            DBGFSELINFO SelInfo;
    38423851
    3843             rc = SELMR3GetShadowSelectorInfo(pVM, pCtx->cs, &SelInfo);
     3852            rc = SELMR3GetShadowSelectorInfo(pVM, pCtx->cs.Sel, &SelInfo);
    38443853            if (RT_FAILURE(rc))
    38453854            {
    3846                 AssertMsgFailed(("SELMR3GetShadowSelectorInfo failed for %04X:%RGv rc=%d\n", pCtx->cs, GCPtrPC, rc));
     3855                AssertMsgFailed(("SELMR3GetShadowSelectorInfo failed for %04X:%RGv rc=%d\n", pCtx->cs.Sel, GCPtrPC, rc));
    38473856                return rc;
    38483857            }
     
    38513860             * Validate the selector.
    38523861             */
    3853             rc = DBGFR3SelInfoValidateCS(&SelInfo, pCtx->ss);
     3862            rc = DBGFR3SelInfoValidateCS(&SelInfo, pCtx->ss.Sel);
    38543863            if (RT_FAILURE(rc))
    38553864            {
    3856                 AssertMsgFailed(("SELMSelInfoValidateCS failed for %04X:%RGv rc=%d\n", pCtx->cs, GCPtrPC, rc));
     3865                AssertMsgFailed(("SELMSelInfoValidateCS failed for %04X:%RGv rc=%d\n", pCtx->cs.Sel, GCPtrPC, rc));
    38573866                return rc;
    38583867            }
     
    38673876        /* real or V86 mode */
    38683877        enmDisCpuMode         = DISCPUMODE_16BIT;
    3869         State.GCPtrSegBase    = pCtx->cs * 16;
     3878        State.GCPtrSegBase    = pCtx->cs.Sel * 16;
    38703879        State.GCPtrSegEnd     = 0xFFFFFFFF;
    38713880        State.cbSegLimit      = 0xFFFFFFFF;
     
    38953904    }
    38963905    else
    3897         Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%RGv rc=%Rrc\n", pCtx->cs, GCPtrPC, rc));
     3906        Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%RGv rc=%Rrc\n", pCtx->cs.Sel, GCPtrPC, rc));
    38983907
    38993908    /* Release mapping lock acquired in cpumR3DisasInstrRead. */
     
    40094018     * Are we in Ring-0?
    40104019     */
    4011     if (    pCtxCore->ss && (pCtxCore->ss & X86_SEL_RPL) == 0
     4020    if (    pCtxCore->ss.Sel && (pCtxCore->ss.Sel & X86_SEL_RPL) == 0
    40124021        &&  !pCtxCore->eflags.Bits.u1VM)
    40134022    {
     
    40204029         * Set CPL to Ring-1.
    40214030         */
    4022         pCtxCore->ss |= 1;
    4023         if (pCtxCore->cs && (pCtxCore->cs & X86_SEL_RPL) == 0)
    4024             pCtxCore->cs |= 1;
     4031        pCtxCore->ss.Sel |= 1;
     4032        if (pCtxCore->cs.Sel && (pCtxCore->cs.Sel & X86_SEL_RPL) == 0)
     4033            pCtxCore->cs.Sel |= 1;
    40254034    }
    40264035    else
    40274036    {
    4028         AssertMsg((pCtxCore->ss & X86_SEL_RPL) >= 2 || pCtxCore->eflags.Bits.u1VM,
     4037        AssertMsg((pCtxCore->ss.Sel & X86_SEL_RPL) >= 2 || pCtxCore->eflags.Bits.u1VM,
    40294038                  ("ring-1 code not supported\n"));
    40304039        /*
     
    40434052     */
    40444053    AssertMsg((pCtxCore->eflags.u32 & X86_EFL_IF), ("X86_EFL_IF is clear\n"));
    4045     AssertReleaseMsg(   pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss & X86_SEL_RPL)
     4054    AssertReleaseMsg(   pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss.Sel & X86_SEL_RPL)
    40464055                     || pCtxCore->eflags.Bits.u1VM,
    4047                      ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss & X86_SEL_RPL));
     4056                     ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss.Sel & X86_SEL_RPL));
    40484057    Assert((pVCpu->cpum.s.Guest.cr0 & (X86_CR0_PG | X86_CR0_WP | X86_CR0_PE)) == (X86_CR0_PG | X86_CR0_PE | X86_CR0_WP));
    40494058
     
    40824091    if (!pCtxCore)
    40834092        pCtxCore = CPUMCTX2CORE(pCtx);
    4084     Assert(pCtxCore->eflags.Bits.u1VM || (pCtxCore->ss & X86_SEL_RPL));
    4085     AssertMsg(pCtxCore->eflags.Bits.u1VM || pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss & X86_SEL_RPL),
    4086               ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss & X86_SEL_RPL));
     4093    Assert(pCtxCore->eflags.Bits.u1VM || (pCtxCore->ss.Sel & X86_SEL_RPL));
     4094    AssertMsg(pCtxCore->eflags.Bits.u1VM || pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss.Sel & X86_SEL_RPL),
     4095              ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss.Sel & X86_SEL_RPL));
    40874096
    40884097    /*
    40894098     * Are we executing in raw ring-1?
    40904099     */
    4091     if (    (pCtxCore->ss & X86_SEL_RPL) == 1
     4100    if (    (pCtxCore->ss.Sel & X86_SEL_RPL) == 1
    40924101        &&  !pCtxCore->eflags.Bits.u1VM)
    40934102    {
     
    40984107        /* Not quite sure if this is really required, but shouldn't harm (too much anyways). */
    40994108        /** @todo See what happens if we remove this. */
    4100         if ((pCtxCore->ds & X86_SEL_RPL) == 1)
    4101             pCtxCore->ds &= ~X86_SEL_RPL;
    4102         if ((pCtxCore->es & X86_SEL_RPL) == 1)
    4103             pCtxCore->es &= ~X86_SEL_RPL;
    4104         if ((pCtxCore->fs & X86_SEL_RPL) == 1)
    4105             pCtxCore->fs &= ~X86_SEL_RPL;
    4106         if ((pCtxCore->gs & X86_SEL_RPL) == 1)
    4107             pCtxCore->gs &= ~X86_SEL_RPL;
     4109        if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 1)
     4110            pCtxCore->ds.Sel &= ~X86_SEL_RPL;
     4111        if ((pCtxCore->es.Sel & X86_SEL_RPL) == 1)
     4112            pCtxCore->es.Sel &= ~X86_SEL_RPL;
     4113        if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 1)
     4114            pCtxCore->fs.Sel &= ~X86_SEL_RPL;
     4115        if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 1)
     4116            pCtxCore->gs.Sel &= ~X86_SEL_RPL;
    41084117
    41094118        /*
    41104119         * Ring-1 selector => Ring-0.
    41114120         */
    4112         pCtxCore->ss &= ~X86_SEL_RPL;
    4113         if ((pCtxCore->cs & X86_SEL_RPL) == 1)
    4114             pCtxCore->cs &= ~X86_SEL_RPL;
     4121        pCtxCore->ss.Sel &= ~X86_SEL_RPL;
     4122        if ((pCtxCore->cs.Sel & X86_SEL_RPL) == 1)
     4123            pCtxCore->cs.Sel &= ~X86_SEL_RPL;
    41154124    }
    41164125    else
     
    41234132        {
    41244133            /** @todo See what happens if we remove this. */
    4125             if ((pCtxCore->ds & X86_SEL_RPL) == 1)
    4126                 pCtxCore->ds &= ~X86_SEL_RPL;
    4127             if ((pCtxCore->es & X86_SEL_RPL) == 1)
    4128                 pCtxCore->es &= ~X86_SEL_RPL;
    4129             if ((pCtxCore->fs & X86_SEL_RPL) == 1)
    4130                 pCtxCore->fs &= ~X86_SEL_RPL;
    4131             if ((pCtxCore->gs & X86_SEL_RPL) == 1)
    4132                 pCtxCore->gs &= ~X86_SEL_RPL;
     4134            if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 1)
     4135                pCtxCore->ds.Sel &= ~X86_SEL_RPL;
     4136            if ((pCtxCore->es.Sel & X86_SEL_RPL) == 1)
     4137                pCtxCore->es.Sel &= ~X86_SEL_RPL;
     4138            if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 1)
     4139                pCtxCore->fs.Sel &= ~X86_SEL_RPL;
     4140            if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 1)
     4141                pCtxCore->gs.Sel &= ~X86_SEL_RPL;
    41334142        }
    41344143    }
  • trunk/src/VBox/VMM/VMMR3/CPUMDbg.cpp

    r41803 r41906  
    10131013
    10141014#define CPU_REG_SEG(UName, LName) \
    1015     CPU_REG_RW_AS(#LName,           UName,          U16, LName,                 cpumR3RegGet_Generic, cpumR3RegSet_seg,     NULL,                       NULL                ), \
    1016     CPU_REG_RW_AS(#LName "_attr",   UName##_ATTR,   U32, LName##Hid.Attr.u,     cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       g_aCpumRegFields_seg), \
    1017     CPU_REG_RW_AS(#LName "_base",   UName##_BASE,   U64, LName##Hid.u64Base,    cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       NULL                ), \
    1018     CPU_REG_RW_AS(#LName "_lim",    UName##_LIMIT,  U32, LName##Hid.u32Limit,   cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       NULL                )
     1015    CPU_REG_RW_AS(#LName,           UName,          U16, LName.Sel,             cpumR3RegGet_Generic, cpumR3RegSet_seg,     NULL,                       NULL                ), \
     1016    CPU_REG_RW_AS(#LName "_attr",   UName##_ATTR,   U32, LName.Attr.u,          cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       g_aCpumRegFields_seg), \
     1017    CPU_REG_RW_AS(#LName "_base",   UName##_BASE,   U64, LName.u64Base,         cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       NULL                ), \
     1018    CPU_REG_RW_AS(#LName "_lim",    UName##_LIMIT,  U32, LName.u32Limit,        cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       NULL                )
    10191019
    10201020#define CPU_REG_MM(n) \
  • trunk/src/VBox/VMM/VMMR3/CSAM.cpp

    r41886 r41906  
    22952295    {
    22962296        /* Assuming 32 bits code for now. */
    2297         Assert(SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pCtxCore->eflags, pCtxCore->cs, &pCtxCore->csHid) == DISCPUMODE_32BIT);
     2297        Assert(SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pCtxCore->eflags, pCtxCore->cs.Sel, &pCtxCore->cs) == DISCPUMODE_32BIT);
    22982298
    22992299        pInstrGC = SELMToFlat(pVM, DISSELREG_CS, pCtxCore, pInstrGC);
  • trunk/src/VBox/VMM/VMMR3/DBGF.cpp

    r41801 r41906  
    588588        /* @todo SMP support!! */
    589589        PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu(pVM));
    590         RTGCPTR  eip = pCtx->rip + pCtx->csHid.u64Base;
     590        RTGCPTR  eip = pCtx->rip + pCtx->cs.u64Base;
    591591#endif
    592592        for (iBp = 0; iBp < RT_ELEMENTS(pVM->dbgf.s.aBreakpoints); iBp++)
  • trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp

    r41803 r41906  
    353353        else
    354354            pCtxCore = CPUMGetHyperCtxCore(pVCpu);
    355         Sel        = pCtxCore->cs;
    356         pHiddenSel = (CPUMSELREGHID *)&pCtxCore->csHid;
     355        Sel        = pCtxCore->cs.Sel;
     356        pHiddenSel = (PCPUMSELREGHID)&pCtxCore->cs;
    357357        GCPtr      = pCtxCore->rip;
    358358    }
     
    413413        {   /* Assume the current CS defines the execution mode. */
    414414            pCtxCore   = CPUMGetGuestCtxCore(pVCpu);
    415             pHiddenSel = (CPUMSELREGHID *)&pCtxCore->csHid;
     415            pHiddenSel = (CPUMSELREGHID *)&pCtxCore->cs;
    416416
    417417            SelInfo.u.Raw.Gen.u1Present     = pHiddenSel->Attr.n.u1Present;
  • trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp

    r41783 r41906  
    301301        pCur->AddrPC = *pAddrPC;
    302302    else
    303         rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrPC, pCtxCore->cs, pCtxCore->rip);
     303        rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrPC, pCtxCore->cs.Sel, pCtxCore->rip);
    304304    if (RT_SUCCESS(rc))
    305305    {
     
    341341            pCur->AddrStack = *pAddrStack;
    342342        else
    343             rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrStack, pCtxCore->ss, pCtxCore->rsp & fAddrMask);
     343            rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrStack, pCtxCore->ss.Sel, pCtxCore->rsp & fAddrMask);
    344344
    345345        if (pAddrFrame)
    346346            pCur->AddrFrame = *pAddrFrame;
    347347        else if (RT_SUCCESS(rc))
    348             rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrFrame, pCtxCore->ss, pCtxCore->rbp & fAddrMask);
     348            rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrFrame, pCtxCore->ss.Sel, pCtxCore->rbp & fAddrMask);
    349349    }
    350350    else
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r41801 r41906  
    965965
    966966    if (pCtx->eflags.Bits.u1VM)
    967         Log(("EMV86: %04X:%08X IF=%d\n", pCtx->cs, pCtx->eip, pCtx->eflags.Bits.u1IF));
     967        Log(("EMV86: %04X:%08X IF=%d\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags.Bits.u1IF));
    968968    else
    969         Log(("EMR%d: %04X:%08X ESP=%08X IF=%d CR0=%x eflags=%x\n", cpl, pCtx->cs, pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, (uint32_t)pCtx->cr0, pCtx->eflags.u));
     969        Log(("EMR%d: %04X:%08X ESP=%08X IF=%d CR0=%x eflags=%x\n", cpl, pCtx->cs.Sel, pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, (uint32_t)pCtx->cr0, pCtx->eflags.u));
    970970#endif
    971971    STAM_REL_PROFILE_ADV_START(&pVCpu->em.s.StatREMTotal, a);
     
    12431243    }
    12441244
    1245     unsigned uSS = pCtx->ss;
     1245    unsigned uSS = pCtx->ss.Sel;
    12461246    if (    pCtx->eflags.Bits.u1VM
    12471247        ||  (uSS & X86_SEL_RPL) == 3)
     
    12761276        // Let's start with pure 32 bits ring 0 code first
    12771277        /** @todo What's pure 32-bit mode? flat? */
    1278         if (    !(pCtx->ssHid.Attr.n.u1DefBig)
    1279             ||  !(pCtx->csHid.Attr.n.u1DefBig))
     1278        if (    !(pCtx->ss.Attr.n.u1DefBig)
     1279            ||  !(pCtx->cs.Attr.n.u1DefBig))
    12801280        {
    12811281            Log2(("raw r0 mode refused: SS/CS not 32bit\n"));
  • trunk/src/VBox/VMM/VMMR3/EMHwaccm.cpp

    r41836 r41906  
    231231#endif /* 0 */
    232232    STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, a);
    233     Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp));
     233    Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp));
    234234#ifdef VBOX_WITH_REM
    235235    EMRemLock(pVM);
     
    469469    PCPUMCTX pCtx = pVCpu->em.s.pCtx;
    470470
    471     LogFlow(("emR3HwAccExecute%d: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pCtx->cs, (RTGCPTR)pCtx->rip));
     471    LogFlow(("emR3HwAccExecute%d: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pCtx->cs.Sel, (RTGCPTR)pCtx->rip));
    472472    *pfFFDone = false;
    473473
     
    509509         */
    510510        if (TRPMHasTrap(pVCpu))
    511             Log(("CPU%d: Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", pVCpu->idCpu, TRPMGetTrapNo(pVCpu), pCtx->cs, (RTGCPTR)pCtx->rip));
     511            Log(("CPU%d: Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", pVCpu->idCpu, TRPMGetTrapNo(pVCpu), pCtx->cs.Sel, (RTGCPTR)pCtx->rip));
    512512
    513513        uint32_t cpl = CPUMGetGuestCPL(pVCpu, CPUMCTX2CORE(pCtx));
     
    518518                Log(("HWV86: %08X IF=%d\n", pCtx->eip, pCtx->eflags.Bits.u1IF));
    519519            else if (CPUMIsGuestIn64BitCodeEx(pCtx))
    520                 Log(("HWR%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs, (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
     520                Log(("HWR%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
    521521            else
    522                 Log(("HWR%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs,          pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
     522                Log(("HWR%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs.Sel,          pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
    523523        }
    524524        else
     
    527527                Log(("HWV86-CPU%d: %08X IF=%d\n", pVCpu->idCpu, pCtx->eip, pCtx->eflags.Bits.u1IF));
    528528            else if (CPUMIsGuestIn64BitCodeEx(pCtx))
    529                 Log(("HWR%d-CPU%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs, (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
     529                Log(("HWR%d-CPU%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
    530530            else
    531                 Log(("HWR%d-CPU%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs,          pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
     531                Log(("HWR%d-CPU%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs.Sel,          pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));
    532532        }
    533533#endif /* LOG_ENABLED */
  • trunk/src/VBox/VMM/VMMR3/EMRaw.cpp

    r41801 r41906  
    123123    PCPUMCTX    pCtx = pVCpu->em.s.pCtx;
    124124    Assert(pVCpu->em.s.enmState == EMSTATE_DEBUG_HYPER);
    125     Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr\n", pCtx->cs, pCtx->eip, pCtx->eflags));
     125    Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags));
    126126
    127127    /*
     
    131131    CPUMSetHyperEFlags(pVCpu, CPUMGetHyperEFlags(pVCpu) | X86_EFL_RF);
    132132    rc = VMMR3ResumeHyper(pVM, pVCpu);
    133     Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr - returned from GC with rc=%Rrc\n", pCtx->cs, pCtx->eip, pCtx->eflags, rc));
     133    Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr - returned from GC with rc=%Rrc\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags, rc));
    134134    rc = CPUMR3RawLeave(pVCpu, NULL, rc);
    135135    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK);
     
    367367
    368368    STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, a);
    369     Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp));
     369    Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp));
    370370#ifdef VBOX_WITH_REM
    371371    EMRemLock(pVM);
     
    578578     */
    579579    /** @todo move this up before the dispatching? */
    580     if (    (pCtx->ss & X86_SEL_RPL) <= 1
     580    if (    (pCtx->ss.Sel & X86_SEL_RPL) <= 1
    581581        &&  !pCtx->eflags.Bits.u1VM)
    582582    {
     
    643643    int rc2 = PGMGstGetPage(pVCpu, uCR2, &fFlags, &GCPhys);
    644644    Log(("emR3RawGuestTrap: cs:eip=%04x:%08x: trap=%02x err=%08x cr2=%08x cr0=%08x%s: Phys=%RGp fFlags=%08llx %s %s %s%s rc2=%d\n",
    645          pCtx->cs, pCtx->eip, u8TrapNo, uErrorCode, uCR2, (uint32_t)pCtx->cr0, (enmType == TRPM_SOFTWARE_INT) ? " software" : "",  GCPhys, fFlags,
     645         pCtx->cs.Sel, pCtx->eip, u8TrapNo, uErrorCode, uCR2, (uint32_t)pCtx->cr0,
     646         (enmType == TRPM_SOFTWARE_INT) ? " software" : "",  GCPhys, fFlags,
    646647         fFlags & X86_PTE_P  ? "P " : "NP", fFlags & X86_PTE_US ? "U"  : "S",
    647648         fFlags & X86_PTE_RW ? "RW" : "R0", fFlags & X86_PTE_G  ? " G" : "", rc2));
     
    684685            {
    685686                rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip),
    686                                         (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0);
     687                                           SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs)
     688                                        == DISCPUMODE_32BIT ? PATMFL_CODE32 : 0);
    687689                if (RT_SUCCESS(rc))
    688690                {
     
    929931            return VERR_EM_RAW_PATCH_CONFLICT;
    930932        }
    931         if (   (pCtx->ss & X86_SEL_RPL) == 0
     933        if (   (pCtx->ss.Sel & X86_SEL_RPL) == 0
    932934            && !pCtx->eflags.Bits.u1VM
    933935            && !PATMIsPatchGCAddr(pVM, pCtx->eip))
    934936        {
    935937            int rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip),
    936                                         (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0);
     938                                        (   SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs)
     939                                         == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0);
    937940            if (RT_SUCCESS(rc))
    938941            {
     
    10391042        }
    10401043#endif /* VBOX_WITH_STATISTICS */
    1041         if (    (pCtx->ss & X86_SEL_RPL) == 0
     1044        if (    (pCtx->ss.Sel & X86_SEL_RPL) == 0
    10421045            &&  !pCtx->eflags.Bits.u1VM
    1043             &&  SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT)
     1046            &&  SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs) == DISCPUMODE_32BIT)
    10441047        {
    10451048            STAM_PROFILE_START(&pVCpu->em.s.StatPrivEmu, a);
     
    13391342    int      rc = VERR_IPE_UNINITIALIZED_STATUS;
    13401343    PCPUMCTX pCtx = pVCpu->em.s.pCtx;
    1341     LogFlow(("emR3RawExecute: (cs:eip=%04x:%08x)\n", pCtx->cs, pCtx->eip));
     1344    LogFlow(("emR3RawExecute: (cs:eip=%04x:%08x)\n", pCtx->cs.Sel, pCtx->eip));
    13421345    pVCpu->em.s.fForceRAW = false;
    13431346    *pfFFDone = false;
     
    13611364        Assert(REMR3QueryPendingInterrupt(pVM, pVCpu) == REM_NO_PENDING_IRQ);
    13621365# endif
    1363         Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss & X86_SEL_RPL) == 3 || (pCtx->ss & X86_SEL_RPL) == 0);
     1366        Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss.Sel & X86_SEL_RPL) == 3 || (pCtx->ss.Sel & X86_SEL_RPL) == 0);
    13641367        AssertMsg(   (pCtx->eflags.u32 & X86_EFL_IF)
    13651368                  || PATMShouldUseRawMode(pVM, (RTGCPTR)pCtx->eip),
     
    14011404         * Scan code before executing it. Don't bother with user mode or V86 code
    14021405         */
    1403         if (    (pCtx->ss & X86_SEL_RPL) <= 1
     1406        if (    (pCtx->ss.Sel & X86_SEL_RPL) <= 1
    14041407            &&  !pCtx->eflags.Bits.u1VM
    14051408            && !PATMIsPatchGCAddr(pVM, pCtx->eip))
     
    14271430        PPATMGCSTATE pGCState = PATMR3QueryGCStateHC(pVM);
    14281431        if (pCtx->eflags.Bits.u1VM)
    1429             Log(("RV86: %04X:%08X IF=%d VMFlags=%x\n", pCtx->cs, pCtx->eip, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags));
    1430         else if ((pCtx->ss & X86_SEL_RPL) == 1)
     1432            Log(("RV86: %04X:%08X IF=%d VMFlags=%x\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags));
     1433        else if ((pCtx->ss.Sel & X86_SEL_RPL) == 1)
    14311434        {
    14321435            bool fCSAMScanned = CSAMIsPageScanned(pVM, (RTGCPTR)pCtx->eip);
    1433             Log(("RR0: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d (Scanned=%d)\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss & X86_SEL_RPL), fCSAMScanned));
    1434         }
    1435         else if ((pCtx->ss & X86_SEL_RPL) == 3)
     1436            Log(("RR0: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d (Scanned=%d)\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss.Sel & X86_SEL_RPL), fCSAMScanned));
     1437        }
     1438        else if ((pCtx->ss.Sel & X86_SEL_RPL) == 3)
    14361439            Log(("RR3: %08X ESP=%08X IF=%d VMFlags=%x\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags));
    14371440#endif /* LOG_ENABLED */
     
    14611464        STAM_PROFILE_ADV_START(&pVCpu->em.s.StatRAWTail, d);
    14621465
    1463         LogFlow(("RR0-E: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss & X86_SEL_RPL)));
     1466        LogFlow(("RR0-E: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss.Sel & X86_SEL_RPL)));
    14641467        LogFlow(("VMMR3RawRunGC returned %Rrc\n", rc));
    14651468
     
    15421545            ||  VMCPU_FF_ISPENDING(pVCpu, ~VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK))
    15431546        {
    1544             Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss & X86_SEL_RPL) != 1);
     1547            Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss.Sel & X86_SEL_RPL) != 1);
    15451548
    15461549            STAM_REL_PROFILE_ADV_SUSPEND(&pVCpu->em.s.StatRAWTotal, a);
  • trunk/src/VBox/VMM/VMMR3/HWACCM.cpp

    r41894 r41906  
    15171517
    15181518            /* After a real mode switch to protected mode we must force
    1519              * CPL to 0. Our real mode emulation had to set it to 3.
    1520              */
    1521             pCtx->ssHid.Attr.n.u2Dpl  = 0;
     1519               CPL to 0. Our real mode emulation had to set it to 3. */
     1520            pCtx->ss.Attr.n.u2Dpl  = 0;
    15221521        }
    15231522    }
     
    21632162            {
    21642163                char     szOutput[256];
    2165                 rc = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, GCPtrInstr, DBGF_DISAS_FLAGS_DEFAULT_MODE,
     2164                rc = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, GCPtrInstr, DBGF_DISAS_FLAGS_DEFAULT_MODE,
    21662165                                        szOutput, sizeof(szOutput), &cbCurInstr);
    21672166                if (RT_SUCCESS(rc))
     
    23052304            if (CPUMIsGuestInRealModeEx(pCtx))
    23062305            {
    2307                 /* VT-x will not allow high selector bases in v86 mode; fall back to the recompiler in that case.
    2308                  * The base must also be equal to (sel << 4).
    2309                  */
    2310                 if (   (   pCtx->cs != (pCtx->csHid.u64Base >> 4)
    2311                         && pCtx->csHid.u64Base != 0xffff0000 /* we can deal with the BIOS code as it's also mapped into the lower region. */)
    2312                     || (pCtx->csHid.u32Limit != 0xffff)
    2313                     || (pCtx->dsHid.u32Limit != 0xffff)
    2314                     || (pCtx->esHid.u32Limit != 0xffff)
    2315                     || (pCtx->ssHid.u32Limit != 0xffff)
    2316                     || (pCtx->fsHid.u32Limit != 0xffff)
    2317                     || (pCtx->gsHid.u32Limit != 0xffff)
    2318                     || pCtx->ds != (pCtx->dsHid.u64Base >> 4)
    2319                     || pCtx->es != (pCtx->esHid.u64Base >> 4)
    2320                     || pCtx->fs != (pCtx->fsHid.u64Base >> 4)
    2321                     || pCtx->gs != (pCtx->gsHid.u64Base >> 4)
    2322                     || pCtx->ss != (pCtx->ssHid.u64Base >> 4))
     2306                /* VT-x will not allow high selector bases in v86 mode; fall
     2307                   back to the recompiler in that case.
     2308                   The base must also be equal to (sel << 4). */
     2309                if (   (   pCtx->cs.Sel != (pCtx->cs.u64Base >> 4)
     2310                        && pCtx->cs.u64Base != 0xffff0000 /* we can deal with the BIOS code as it's also mapped into the lower region. */)
     2311                    || (pCtx->cs.u32Limit != 0xffff)
     2312                    || (pCtx->ds.u32Limit != 0xffff)
     2313                    || (pCtx->es.u32Limit != 0xffff)
     2314                    || (pCtx->ss.u32Limit != 0xffff)
     2315                    || (pCtx->fs.u32Limit != 0xffff)
     2316                    || (pCtx->gs.u32Limit != 0xffff)
     2317                    || pCtx->ds.Sel != (pCtx->ds.u64Base >> 4)
     2318                    || pCtx->es.Sel != (pCtx->es.u64Base >> 4)
     2319                    || pCtx->fs.Sel != (pCtx->fs.u64Base >> 4)
     2320                    || pCtx->gs.Sel != (pCtx->gs.u64Base >> 4)
     2321                    || pCtx->ss.Sel != (pCtx->ss.u64Base >> 4))
    23232322                {
    23242323                    return false;
     
    23282327            {
    23292328                PGMMODE enmGuestMode = PGMGetGuestMode(pVCpu);
    2330                 /* Verify the requirements for executing code in protected mode. VT-x can't handle the CPU state right after a switch
    2331                  * from real to protected mode. (all sorts of RPL & DPL assumptions)
    2332                  */
     2329                /* Verify the requirements for executing code in protected
     2330                   mode. VT-x can't handle the CPU state right after a switch
     2331                   from real to protected mode. (all sorts of RPL & DPL assumptions) */
    23332332                if (    pVCpu->hwaccm.s.vmx.enmLastSeenGuestMode == PGMMODE_REAL
    23342333                    &&  enmGuestMode >= PGMMODE_PROTECTED)
    23352334                {
    2336                     if (   (pCtx->cs & X86_SEL_RPL)
    2337                         || (pCtx->ds & X86_SEL_RPL)
    2338                         || (pCtx->es & X86_SEL_RPL)
    2339                         || (pCtx->fs & X86_SEL_RPL)
    2340                         || (pCtx->gs & X86_SEL_RPL)
    2341                         || (pCtx->ss & X86_SEL_RPL))
     2335                    if (   (pCtx->cs.Sel & X86_SEL_RPL)
     2336                        || (pCtx->ds.Sel & X86_SEL_RPL)
     2337                        || (pCtx->es.Sel & X86_SEL_RPL)
     2338                        || (pCtx->fs.Sel & X86_SEL_RPL)
     2339                        || (pCtx->gs.Sel & X86_SEL_RPL)
     2340                        || (pCtx->ss.Sel & X86_SEL_RPL))
    23422341                    {
    23432342                        return false;
     
    23462345                /* VT-x also chokes on invalid tr or ldtr selectors (minix) */
    23472346                if (    pCtx->gdtr.cbGdt
    2348                     &&  (   pCtx->tr > pCtx->gdtr.cbGdt
    2349                          || pCtx->ldtr > pCtx->gdtr.cbGdt))
     2347                    &&  (   pCtx->tr.Sel > pCtx->gdtr.cbGdt
     2348                         || pCtx->ldtr.Sel > pCtx->gdtr.cbGdt))
    23502349                {
    23512350                        return false;
     
    23702369
    23712370                /* Too early for VT-x; Solaris guests will fail with a guru meditation otherwise; same for XP. */
    2372                 if (pCtx->idtr.pIdt == 0 || pCtx->idtr.cbIdt == 0 || pCtx->tr == 0)
     2371                if (pCtx->idtr.pIdt == 0 || pCtx->idtr.cbIdt == 0 || pCtx->tr.Sel == 0)
    23732372                    return false;
    23742373
     
    23762375                /* Windows XP; switch to protected mode; all selectors are marked not present in the
    23772376                 * hidden registers (possible recompiler bug; see load_seg_vm) */
    2378                 if (pCtx->csHid.Attr.n.u1Present == 0)
     2377                if (pCtx->cs.Attr.n.u1Present == 0)
    23792378                    return false;
    2380                 if (pCtx->ssHid.Attr.n.u1Present == 0)
     2379                if (pCtx->ss.Attr.n.u1Present == 0)
    23812380                    return false;
    23822381
     
    23852384                /** @todo This check is actually wrong, it doesn't take the direction of the
    23862385                 *        stack segment into account. But, it does the job for now. */
    2387                 if (pCtx->rsp >= pCtx->ssHid.u32Limit)
     2386                if (pCtx->rsp >= pCtx->ss.u32Limit)
    23882387                    return false;
    23892388#if 0
    2390                 if (    pCtx->cs >= pCtx->gdtr.cbGdt
    2391                     ||  pCtx->ss >= pCtx->gdtr.cbGdt
    2392                     ||  pCtx->ds >= pCtx->gdtr.cbGdt
    2393                     ||  pCtx->es >= pCtx->gdtr.cbGdt
    2394                     ||  pCtx->fs >= pCtx->gdtr.cbGdt
    2395                     ||  pCtx->gs >= pCtx->gdtr.cbGdt)
     2389                if (    pCtx->cs.Sel >= pCtx->gdtr.cbGdt
     2390                    ||  pCtx->ss.Sel >= pCtx->gdtr.cbGdt
     2391                    ||  pCtx->ds.Sel >= pCtx->gdtr.cbGdt
     2392                    ||  pCtx->es.Sel >= pCtx->gdtr.cbGdt
     2393                    ||  pCtx->fs.Sel >= pCtx->gdtr.cbGdt
     2394                    ||  pCtx->gs.Sel >= pCtx->gdtr.cbGdt)
    23962395                    return false;
    23972396#endif
  • trunk/src/VBox/VMM/VMMR3/PATM.cpp

    r41898 r41906  
    40884088        if (pInstrGCFlat != pInstrGC)
    40894089        {
    4090             Log(("PATMR3InstallPatch: code selector not wide open: %04x:%RRv != %RRv eflags=%08x\n", pCtx->cs, pInstrGCFlat, pInstrGC, pCtx->eflags.u32));
     4090            Log(("PATMR3InstallPatch: code selector not wide open: %04x:%RRv != %RRv eflags=%08x\n", pCtx->cs.Sel, pInstrGCFlat, pInstrGC, pCtx->eflags.u32));
    40914091            return VERR_PATCHING_REFUSED;
    40924092        }
     
    61056105#ifdef DEBUG
    61066106        char szBuf[256];
    6107         DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
     6107        DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
    61086108                           szBuf, sizeof(szBuf), NULL);
    61096109        Log(("DIRTY: %s\n", szBuf));
     
    61686168#ifdef DEBUG
    61696169                char szBuf[256];
    6170                 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
     6170                DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
    61716171                                   szBuf, sizeof(szBuf), NULL);
    61726172                Log(("NEW:   %s\n", szBuf));
     
    61846184#ifdef DEBUG
    61856185                char szBuf[256];
    6186                 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
     6186                DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
    61876187                                   szBuf, sizeof(szBuf), NULL);
    61886188                Log(("NEW:   %s (FAILED)\n", szBuf));
     
    62216221#ifdef DEBUG
    62226222                            char szBuf[256];
    6223                             DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
     6223                            DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,
    62246224                                               szBuf, sizeof(szBuf), NULL);
    62256225                            Log(("FILL:  %s\n", szBuf));
     
    62336233#ifdef DEBUG
    62346234                                char szBuf[256];
    6235                                 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC + i,
     6235                                DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurPatchInstrGC + i,
    62366236                                                   DBGF_DISAS_FLAGS_DEFAULT_MODE, szBuf, sizeof(szBuf), NULL);
    62376237                                Log(("FILL:  %s\n", szBuf));
     
    64256425
    64266426        char szBuf[256];
    6427         DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pEip, DBGF_DISAS_FLAGS_DEFAULT_MODE, szBuf, sizeof(szBuf), NULL);
     6427        DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pEip, DBGF_DISAS_FLAGS_DEFAULT_MODE, szBuf, sizeof(szBuf), NULL);
    64286428
    64296429        /* Very bad. We crashed in emitted code. Probably stack? */
     
    65426542
    65436543    Log2(("pPatchBlockGC %RRv - pEip %RRv corresponding GC address %RRv\n", PATCHCODE_PTR_GC(&pPatch->patch), pEip, pNewEip));
    6544     DBGFR3DisasInstrLog(pVCpu, pCtx->cs, pNewEip, "PATCHRET: ");
     6544    DBGFR3DisasInstrLog(pVCpu, pCtx->cs.Sel, pNewEip, "PATCHRET: ");
    65456545    if (pNewEip >= pPatch->patch.pPrivInstrGC && pNewEip < pPatch->patch.pPrivInstrGC + pPatch->patch.cbPatchJump)
    65466546    {
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r41803 r41906  
    13301330    PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
    13311331
    1332     pCtx->cs                        = uVector << 8;
    1333     pCtx->csHid.u64Base             = uVector << 12;
    1334     pCtx->csHid.u32Limit            = 0x0000ffff;
    1335     pCtx->rip                       = 0;
     1332    pCtx->cs.Sel        = uVector << 8;
     1333    pCtx->cs.ValidSel   = uVector << 8;
     1334    pCtx->cs.fFlags     = CPUMSELREG_FLAGS_VALID;
     1335    pCtx->cs.u64Base    = uVector << 12;
     1336    pCtx->cs.u32Limit   = UINT32_C(0x0000ffff);
     1337    pCtx->rip           = 0;
    13361338
    13371339    Log(("vmmR3SendSipi for VCPU %d with vector %x\n", uVector));
  • trunk/src/VBox/VMM/VMMR3/VMMTests.cpp

    r41783 r41906  
    448448
    449449#define SYNC_SEL(pHyperCtx, reg)                                                        \
    450         if (pHyperCtx->reg)                                                             \
     450        if (pHyperCtx->reg.Sel)                                                         \
    451451        {                                                                               \
    452452            DBGFSELINFO selInfo;                                                        \
    453             int rc2 = SELMR3GetShadowSelectorInfo(pVM, pHyperCtx->reg, &selInfo);       \
     453            int rc2 = SELMR3GetShadowSelectorInfo(pVM, pHyperCtx->reg.Sel, &selInfo);   \
    454454            AssertRC(rc2);                                                              \
    455455                                                                                        \
    456             pHyperCtx->reg##Hid.u64Base              = selInfo.GCPtrBase;               \
    457             pHyperCtx->reg##Hid.u32Limit             = selInfo.cbLimit;                 \
    458             pHyperCtx->reg##Hid.Attr.n.u1Present     = selInfo.u.Raw.Gen.u1Present;     \
    459             pHyperCtx->reg##Hid.Attr.n.u1DefBig      = selInfo.u.Raw.Gen.u1DefBig;      \
    460             pHyperCtx->reg##Hid.Attr.n.u1Granularity = selInfo.u.Raw.Gen.u1Granularity; \
    461             pHyperCtx->reg##Hid.Attr.n.u4Type        = selInfo.u.Raw.Gen.u4Type;        \
    462             pHyperCtx->reg##Hid.Attr.n.u2Dpl         = selInfo.u.Raw.Gen.u2Dpl;         \
    463             pHyperCtx->reg##Hid.Attr.n.u1DescType    = selInfo.u.Raw.Gen.u1DescType;    \
    464             pHyperCtx->reg##Hid.Attr.n.u1Long        = selInfo.u.Raw.Gen.u1Long;        \
     456            pHyperCtx->reg.u64Base              = selInfo.GCPtrBase;                    \
     457            pHyperCtx->reg.u32Limit             = selInfo.cbLimit;                      \
     458            pHyperCtx->reg.Attr.n.u1Present     = selInfo.u.Raw.Gen.u1Present;          \
     459            pHyperCtx->reg.Attr.n.u1DefBig      = selInfo.u.Raw.Gen.u1DefBig;           \
     460            pHyperCtx->reg.Attr.n.u1Granularity = selInfo.u.Raw.Gen.u1Granularity;      \
     461            pHyperCtx->reg.Attr.n.u4Type        = selInfo.u.Raw.Gen.u4Type;             \
     462            pHyperCtx->reg.Attr.n.u2Dpl         = selInfo.u.Raw.Gen.u2Dpl;              \
     463            pHyperCtx->reg.Attr.n.u1DescType    = selInfo.u.Raw.Gen.u1DescType;         \
     464            pHyperCtx->reg.Attr.n.u1Long        = selInfo.u.Raw.Gen.u1Long;             \
    465465        }
    466466
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