Changeset 42610 in vbox for trunk/src/VBox
- Timestamp:
- Aug 6, 2012 12:44:09 AM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r42487 r42610 288 288 289 289 /** 290 * Checks if a intel CPUID feature is present.290 * Checks if an Intel CPUID feature is present. 291 291 */ 292 292 #define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(a_fEdx) \ 293 293 ( ((a_fEdx) & (X86_CPUID_FEATURE_EDX_TSC | 0)) \ 294 294 || iemRegIsIntelCpuIdFeaturePresent(pIemCpu, (a_fEdx), 0) ) 295 296 /** 297 * Evaluates to true if we're presenting an Intel CPU to the guest. 298 */ 299 #define IEM_IS_GUEST_CPU_INTEL(a_pIemCpu) (true) /** @todo determin this once and store it the CPU structure */ 300 301 /** 302 * Evaluates to true if we're presenting an AMD CPU to the guest. 303 */ 304 #define IEM_IS_GUEST_CPU_AMD(a_pIemCpu) (false) /** @todo determin this once and store it the CPU structure */ 295 305 296 306 /** … … 5442 5452 } 5443 5453 return rc; 5454 } 5455 5456 5457 /** 5458 * Stores a descriptor register (sgdt, sidt). 5459 * 5460 * @returns Strict VBox status code. 5461 * @param pIemCpu The IEM per CPU data. 5462 * @param cbLimit The limit. 5463 * @param GCPTrBase The base address. 5464 * @param iSegReg The index of the segment register to use for 5465 * this access. The base and limits are checked. 5466 * @param GCPtrMem The address of the guest memory. 5467 * @param enmOpSize The effective operand size. 5468 */ 5469 static VBOXSTRICTRC iemMemStoreDataXdtr(PIEMCPU pIemCpu, uint16_t cbLimit, RTGCPTR GCPtrBase, 5470 uint8_t iSegReg, RTGCPTR GCPtrMem, IEMMODE enmOpSize) 5471 { 5472 uint8_t *pu8Src; 5473 VBOXSTRICTRC rcStrict = iemMemMap(pIemCpu, 5474 (void **)&pu8Src, 5475 enmOpSize == IEMMODE_64BIT 5476 ? 2 + 8 5477 : enmOpSize == IEMMODE_32BIT 5478 ? 2 + 4 5479 : 2 + 3, 5480 iSegReg, 5481 GCPtrMem, 5482 IEM_ACCESS_DATA_W); 5483 if (rcStrict == VINF_SUCCESS) 5484 { 5485 pu8Src[0] = RT_BYTE1(cbLimit); 5486 pu8Src[1] = RT_BYTE2(cbLimit); 5487 pu8Src[2] = RT_BYTE1(GCPtrBase); 5488 pu8Src[3] = RT_BYTE2(GCPtrBase); 5489 pu8Src[4] = RT_BYTE3(GCPtrBase); 5490 if (enmOpSize == IEMMODE_16BIT) 5491 pu8Src[5] = 0; /* Note! the 286 stored 0xff here. */ 5492 else 5493 { 5494 pu8Src[5] = RT_BYTE4(GCPtrBase); 5495 if (enmOpSize == IEMMODE_64BIT) 5496 { 5497 pu8Src[6] = RT_BYTE5(GCPtrBase); 5498 pu8Src[7] = RT_BYTE6(GCPtrBase); 5499 pu8Src[8] = RT_BYTE7(GCPtrBase); 5500 pu8Src[9] = RT_BYTE8(GCPtrBase); 5501 } 5502 } 5503 rcStrict = iemMemCommitAndUnmap(pIemCpu, (void *)pu8Src, IEM_ACCESS_DATA_W); 5504 } 5505 return rcStrict; 5444 5506 } 5445 5507 … … 6895 6957 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) \ 6896 6958 iemRecalEffOpSize64Default(pIemCpu); \ 6959 } while (0) 6960 6961 /** The instruction has 64-bit operand size if 64-bit mode. */ 6962 #define IEMOP_HLP_64BIT_OP_SIZE() \ 6963 do \ 6964 { \ 6965 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) \ 6966 pIemCpu->enmEffOpSize = pIemCpu->enmDefOpSize = IEMMODE_64BIT; \ 6897 6967 } while (0) 6898 6968 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r42483 r42610 2721 2721 2722 2722 /** 2723 * Implements sgdt. 2724 * 2725 * @param iEffSeg The segment where to store the gdtr content. 2726 * @param GCPtrEffDst The address where to store the gdtr content. 2727 * @param enmEffOpSize The effective operand size. 2728 */ 2729 IEM_CIMPL_DEF_3(iemCImpl_sgdt, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst, IEMMODE, enmEffOpSize) 2730 { 2731 /* 2732 * Join paths with sgdt. 2733 * Note! No CPL or V8086 checks here, it's a really sad story, as Intel if 2734 * you really must know. 2735 */ 2736 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 2737 VBOXSTRICTRC rcStrict = iemMemStoreDataXdtr(pIemCpu, pCtx->gdtr.cbGdt, pCtx->gdtr.pGdt, iEffSeg, GCPtrEffDst, enmEffOpSize); 2738 if (rcStrict == VINF_SUCCESS) 2739 iemRegAddToRip(pIemCpu, cbInstr); 2740 return rcStrict; 2741 } 2742 2743 2744 /** 2723 2745 * Implements lidt. 2724 2746 * … … 2756 2778 2757 2779 /** 2780 * Implements sidt. 2781 * 2782 * @param iEffSeg The segment where to store the idtr content. 2783 * @param GCPtrEffDst The address where to store the idtr content. 2784 * @param enmEffOpSize The effective operand size. 2785 */ 2786 IEM_CIMPL_DEF_3(iemCImpl_sidt, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst, IEMMODE, enmEffOpSize) 2787 { 2788 /* 2789 * Join paths with sgdt. 2790 * Note! No CPL or V8086 checks here, it's a really sad story, as Intel if 2791 * you really must know. 2792 */ 2793 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 2794 VBOXSTRICTRC rcStrict = iemMemStoreDataXdtr(pIemCpu, pCtx->idtr.cbIdt, pCtx->idtr.pIdt, iEffSeg, GCPtrEffDst, enmEffOpSize); 2795 if (rcStrict == VINF_SUCCESS) 2796 iemRegAddToRip(pIemCpu, cbInstr); 2797 return rcStrict; 2798 } 2799 2800 2801 /** 2758 2802 * Implements lldt. 2759 2803 * … … 2789 2833 { 2790 2834 Log(("lldt %04x: Loading NULL selector.\n", uNewLdt)); 2791 /** @todo check if the actual value is loaded or if it's always 0. */2792 2835 if (!IEM_VERIFICATION_ENABLED(pIemCpu)) 2793 CPUMSetGuestLDTR(IEMCPU_TO_VMCPU(pIemCpu), 0);2836 CPUMSetGuestLDTR(IEMCPU_TO_VMCPU(pIemCpu), uNewLdt); 2794 2837 else 2795 pCtx->ldtr.Sel = 0;2796 pCtx->ldtr.ValidSel = 0;2838 pCtx->ldtr.Sel = uNewLdt; 2839 pCtx->ldtr.ValidSel = uNewLdt; 2797 2840 pCtx->ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 2798 pCtx->ldtr.Attr.u = 0; 2799 pCtx->ldtr.u64Base = 0; 2800 pCtx->ldtr.u32Limit = 0; 2841 if (IEM_IS_GUEST_CPU_AMD(pIemCpu) && !IEM_VERIFICATION_ENABLED(pIemCpu)) 2842 pCtx->ldtr.Attr.u = 0; 2843 else 2844 { 2845 pCtx->ldtr.u64Base = 0; 2846 pCtx->ldtr.u32Limit = 0; 2847 } 2801 2848 2802 2849 iemRegAddToRip(pIemCpu, cbInstr); -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r42487 r42610 624 624 FNIEMOP_DEF_1(iemOp_Grp7_sgdt, uint8_t, bRm) 625 625 { 626 NOREF(pIemCpu); NOREF(bRm); 627 IEMOP_BITCH_ABOUT_STUB(); 628 return VERR_IEM_INSTR_NOT_IMPLEMENTED; 626 IEMOP_HLP_64BIT_OP_SIZE(); 627 IEM_MC_BEGIN(3, 1); 628 IEM_MC_ARG_CONST(uint8_t, iEffSeg, /*=*/pIemCpu->iEffSeg, 0); 629 IEM_MC_ARG(RTGCPTR, GCPtrEffSrc, 1); 630 IEM_MC_ARG_CONST(IEMMODE, enmEffOpSizeArg,/*=*/pIemCpu->enmEffOpSize, 2); 631 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm); 632 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 633 IEM_MC_CALL_CIMPL_3(iemCImpl_sgdt, iEffSeg, GCPtrEffSrc, enmEffOpSizeArg); 634 IEM_MC_END(); 635 return VINF_SUCCESS; 629 636 } 630 637 … … 633 640 FNIEMOP_DEF(iemOp_Grp7_vmcall) 634 641 { 635 AssertFailed();642 IEMOP_BITCH_ABOUT_STUB(); 636 643 return IEMOP_RAISE_INVALID_OPCODE(); 637 644 } … … 641 648 FNIEMOP_DEF(iemOp_Grp7_vmlaunch) 642 649 { 643 AssertFailed();650 IEMOP_BITCH_ABOUT_STUB(); 644 651 return IEMOP_RAISE_INVALID_OPCODE(); 645 652 } … … 649 656 FNIEMOP_DEF(iemOp_Grp7_vmresume) 650 657 { 651 AssertFailed();658 IEMOP_BITCH_ABOUT_STUB(); 652 659 return IEMOP_RAISE_INVALID_OPCODE(); 653 660 } … … 657 664 FNIEMOP_DEF(iemOp_Grp7_vmxoff) 658 665 { 659 AssertFailed();666 IEMOP_BITCH_ABOUT_STUB(); 660 667 return IEMOP_RAISE_INVALID_OPCODE(); 661 668 } … … 665 672 FNIEMOP_DEF_1(iemOp_Grp7_sidt, uint8_t, bRm) 666 673 { 667 NOREF(pIemCpu); NOREF(bRm); 668 IEMOP_BITCH_ABOUT_STUB(); 669 return VERR_IEM_INSTR_NOT_IMPLEMENTED; 674 IEMOP_HLP_64BIT_OP_SIZE(); 675 IEM_MC_BEGIN(3, 1); 676 IEM_MC_ARG_CONST(uint8_t, iEffSeg, /*=*/pIemCpu->iEffSeg, 0); 677 IEM_MC_ARG(RTGCPTR, GCPtrEffSrc, 1); 678 IEM_MC_ARG_CONST(IEMMODE, enmEffOpSizeArg,/*=*/pIemCpu->enmEffOpSize, 2); 679 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm); 680 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 681 IEM_MC_CALL_CIMPL_3(iemCImpl_sidt, iEffSeg, GCPtrEffSrc, enmEffOpSizeArg); 682 IEM_MC_END(); 683 return VINF_SUCCESS; 670 684 } 671 685 … … 694 708 IEMOP_HLP_NO_LOCK_PREFIX(); 695 709 696 IEMMODE enmEffOpSize = pIemCpu->enmCpuMode == IEMMODE_64BIT 697 ? IEMMODE_64BIT 698 : pIemCpu->enmEffOpSize; 710 IEMOP_HLP_64BIT_OP_SIZE(); 699 711 IEM_MC_BEGIN(3, 1); 700 IEM_MC_ARG_CONST(uint8_t, iEffSeg, /*=*/pIemCpu->iEffSeg, 0);701 IEM_MC_ARG(RTGCPTR, GCPtrEffSrc, 1);702 IEM_MC_ARG_CONST(IEMMODE, enmEffOpSizeArg,/*=*/ enmEffOpSize,2);712 IEM_MC_ARG_CONST(uint8_t, iEffSeg, /*=*/pIemCpu->iEffSeg, 0); 713 IEM_MC_ARG(RTGCPTR, GCPtrEffSrc, 1); 714 IEM_MC_ARG_CONST(IEMMODE, enmEffOpSizeArg,/*=*/pIemCpu->enmEffOpSize, 2); 703 715 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm); 704 716 IEM_MC_CALL_CIMPL_3(iemCImpl_lgdt, iEffSeg, GCPtrEffSrc, enmEffOpSizeArg); -
trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp
r42487 r42610 97 97 #define IEMOP_HLP_NO_LOCK_PREFIX() do { } while (0) 98 98 #define IEMOP_HLP_NO_64BIT() do { } while (0) 99 #define IEMOP_HLP_64BIT_OP_SIZE() do { } while (0) 99 100 #define IEMOP_HLP_DEFAULT_64BIT_OP_SIZE() do { } while (0) 100 101 #define IEMOP_HLP_DONE_DECODING() do { } while (0) … … 520 521 #define IEM_MC_FPU_STACK_UNDERFLOW_THEN_POP(a_iStReg) do { } while (0) 521 522 #define IEM_MC_FPU_STACK_UNDERFLOW_MEM_OP_THEN_POP(a_iStReg, a_iEffSeg, a_GCPtrEff) do { } while (0) 522 #define IEM_MC_FPU_STACK_UNDERFLOW_THEN_POP_POP( a_iStReg)do { } while (0)523 #define IEM_MC_FPU_STACK_UNDERFLOW_THEN_POP_POP() do { } while (0) 523 524 #define IEM_MC_FPU_STACK_PUSH_UNDERFLOW() do { } while (0) 524 525 #define IEM_MC_FPU_STACK_PUSH_UNDERFLOW_TWO() do { } while (0)
Note:
See TracChangeset
for help on using the changeset viewer.