Changeset 47558 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Aug 6, 2013 1:50:53 PM (11 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r47548 r47558 3327 3327 3328 3328 /** 3329 * Implements verr (fWrite = false) and verw (fWrite = true). 3330 */ 3331 IEM_CIMPL_DEF_2(iemCImpl_VerX, uint16_t, uSel, bool, fWrite) 3332 { 3333 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 3334 Assert(!IEM_IS_REAL_OR_V86_MODE(pIemCpu)); 3335 3336 /** @todo figure whether the accessed bit is set or not. */ 3337 3338 bool fAccessible = true; 3339 if (!(uSel & X86_SEL_MASK_OFF_RPL)) 3340 fAccessible = false; /** @todo test this on 64-bit. */ 3341 else 3342 { 3343 /* Fetch the descriptor. */ 3344 RTGCPTR GCPtrBase; 3345 if (uSel & X86_SEL_LDT) 3346 { 3347 if ( !pCtx->ldtr.Attr.n.u1Present 3348 || (uSel | X86_SEL_RPL_LDT) > pCtx->ldtr.u32Limit ) 3349 fAccessible = false; 3350 GCPtrBase = pCtx->ldtr.u64Base; 3351 } 3352 else 3353 { 3354 if ((uSel | X86_SEL_RPL_LDT) > pCtx->gdtr.cbGdt) 3355 fAccessible = false; 3356 GCPtrBase = pCtx->gdtr.pGdt; 3357 } 3358 if (fAccessible) 3359 { 3360 IEMSELDESC Desc; 3361 VBOXSTRICTRC rcStrict = iemMemFetchSysU64(pIemCpu, &Desc.Legacy.u, UINT8_MAX, GCPtrBase + (uSel & X86_SEL_MASK)); 3362 if (rcStrict != VINF_SUCCESS) 3363 return rcStrict; 3364 3365 /* Check the descriptor, order doesn't matter much here. */ 3366 if ( !Desc.Legacy.Gen.u1DescType 3367 || !Desc.Legacy.Gen.u1Present) 3368 fAccessible = false; 3369 else 3370 { 3371 if ( fWrite 3372 ? (Desc.Legacy.Gen.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_WRITE)) != X86_SEL_TYPE_WRITE 3373 : (Desc.Legacy.Gen.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_READ)) == X86_SEL_TYPE_CODE) 3374 fAccessible = false; 3375 3376 /** @todo testcase for the conforming behavior. */ 3377 if ( (Desc.Legacy.Gen.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF)) 3378 != (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF)) 3379 { 3380 if ((unsigned)(uSel & X86_SEL_RPL) > Desc.Legacy.Gen.u2Dpl) 3381 fAccessible = false; 3382 else if (pIemCpu->uCpl > Desc.Legacy.Gen.u2Dpl) 3383 fAccessible = false; 3384 } 3385 } 3386 } 3387 } 3388 3389 /* commit */ 3390 pIemCpu->CTX_SUFF(pCtx)->eflags.Bits.u1ZF = fAccessible; 3391 3392 iemRegAddToRip(pIemCpu, cbInstr); 3393 return VINF_SUCCESS; 3394 } 3395 3396 3397 /** 3329 3398 * Implements lgdt. 3330 3399 * -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r47444 r47558 671 671 IEM_MC_ARG(uint16_t, u16Sel, 0); 672 672 IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc); 673 IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO();674 673 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0); 675 674 IEMOP_HLP_DECODED_NL_1(OP_LLDT, IEMOPFORM_M_MEM, OP_PARM_Ew, DISOPTYPE_DANGEROUS); 675 IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO(); /** @todo test order */ 676 676 IEM_MC_FETCH_MEM_U16(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc); 677 677 IEM_MC_CALL_CIMPL_1(iemCImpl_lldt, u16Sel); … … 702 702 IEM_MC_ARG(uint16_t, u16Sel, 0); 703 703 IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc); 704 IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO();705 704 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0); 706 705 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 706 IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO(); /** @todo test ordre */ 707 707 IEM_MC_FETCH_MEM_U16(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc); 708 708 IEM_MC_CALL_CIMPL_1(iemCImpl_ltr, u16Sel); … … 713 713 714 714 715 /** Opcode 0x0f 0x00 /3. */ 716 FNIEMOP_DEF_2(iemOpCommonGrp6VerX, uint8_t, bRm, uint8_t, fWrite) 717 { 718 IEMOP_HLP_NO_REAL_OR_V86_MODE(); 719 720 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 721 { 722 IEMOP_HLP_DECODED_NL_1(fWrite ? OP_VERW : OP_VERR, IEMOPFORM_M_MEM, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 723 IEM_MC_BEGIN(2, 0); 724 IEM_MC_ARG(uint16_t, u16Sel, 0); 725 IEM_MC_ARG_CONST(bool, fWriteArg, fWrite, 1); 726 IEM_MC_FETCH_GREG_U16(u16Sel, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 727 IEM_MC_CALL_CIMPL_2(iemCImpl_VerX, u16Sel, fWriteArg); 728 IEM_MC_END(); 729 } 730 else 731 { 732 IEM_MC_BEGIN(2, 1); 733 IEM_MC_ARG(uint16_t, u16Sel, 0); 734 IEM_MC_ARG_CONST(bool, fWriteArg, fWrite, 1); 735 IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc); 736 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0); 737 IEMOP_HLP_DECODED_NL_1(fWrite ? OP_VERW : OP_VERR, IEMOPFORM_M_MEM, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 738 IEM_MC_FETCH_MEM_U16(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc); 739 IEM_MC_CALL_CIMPL_2(iemCImpl_VerX, u16Sel, fWriteArg); 740 IEM_MC_END(); 741 } 742 return VINF_SUCCESS; 743 } 744 745 715 746 /** Opcode 0x0f 0x00 /4. */ 716 FNIEMOP_STUB_1(iemOp_Grp6_verr, uint8_t, bRm); 747 FNIEMOP_DEF_1(iemOp_Grp6_verr, uint8_t, bRm) 748 { 749 IEMOP_MNEMONIC("verr Ew"); 750 return FNIEMOP_CALL_2(iemOpCommonGrp6VerX, bRm, false); 751 } 717 752 718 753 719 754 /** Opcode 0x0f 0x00 /5. */ 720 FNIEMOP_STUB_1(iemOp_Grp6_verw, uint8_t, bRm); 755 FNIEMOP_DEF_1(iemOp_Grp6_verw, uint8_t, bRm) 756 { 757 IEMOP_MNEMONIC("verr Ew"); 758 return FNIEMOP_CALL_2(iemOpCommonGrp6VerX, bRm, true); 759 } 721 760 722 761
Note:
See TracChangeset
for help on using the changeset viewer.