Changeset 60666 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Apr 22, 2016 11:48:40 PM (9 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r60664 r60666 561 561 { 562 562 case IEMMODE_16BIT: 563 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC564 563 AssertCompile(IEMTARGETCPU_8086 <= IEMTARGETCPU_186 && IEMTARGETCPU_V20 <= IEMTARGETCPU_186 && IEMTARGETCPU_286 > IEMTARGETCPU_186); 565 if ( pIemCpu->uTargetCpu<= IEMTARGETCPU_186)564 if (IEM_GET_TARGET_CPU(pIemCpu) <= IEMTARGETCPU_186) 566 565 fEfl |= UINT16_C(0xf000); 567 #endif568 566 rcStrict = iemMemStackPushU16(pIemCpu, (uint16_t)fEfl); 569 567 break; … … 677 675 fEflNew = u16Value | (fEflOld & UINT32_C(0xffff0000)); 678 676 679 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC680 677 /* 681 678 * Ancient CPU adjustments: … … 689 686 * therefore be used to detect 286 or 386 CPU in real mode. 690 687 */ 691 if ( pIemCpu->uTargetCpu== IEMTARGETCPU_286688 if ( IEM_GET_TARGET_CPU(pIemCpu) == IEMTARGETCPU_286 692 689 && !(pCtx->cr0 & X86_CR0_PE) ) 693 690 fEflNew &= ~(X86_EFL_NT | X86_EFL_IOPL); 694 #endif695 691 break; 696 692 } … … 2776 2772 | X86_EFL_RF /*| X86_EFL_VM*/ | X86_EFL_AC /*|X86_EFL_VIF*/ /*|X86_EFL_VIP*/ 2777 2773 | X86_EFL_ID; 2778 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 2779 if (pIemCpu->uTargetCpu <= IEMTARGETCPU_386) 2774 if (IEM_GET_TARGET_CPU(pIemCpu) <= IEMTARGETCPU_386) 2780 2775 uNewFlags &= ~(X86_EFL_AC | X86_EFL_ID | X86_EFL_VIF | X86_EFL_VIP); 2781 #endif2782 2776 uNewFlags |= Efl.u & (X86_EFL_VM | X86_EFL_VIF | X86_EFL_VIP | X86_EFL_1); 2783 2777 } … … 2795 2789 /** @todo The intel pseudo code does not indicate what happens to 2796 2790 * reserved flags. We just ignore them. */ 2797 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC2798 2791 /* Ancient CPU adjustments: See iemCImpl_popf. */ 2799 if ( pIemCpu->uTargetCpu== IEMTARGETCPU_286)2792 if (IEM_GET_TARGET_CPU(pIemCpu) == IEMTARGETCPU_286) 2800 2793 uNewFlags &= ~(X86_EFL_NT | X86_EFL_IOPL); 2801 #endif2802 2794 } 2803 2795 /** @todo Check how this is supposed to work if sp=0xfffe. */ … … 3263 3255 else if (pIemCpu->uCpl <= pCtx->eflags.Bits.u2IOPL) 3264 3256 fEFlagsMask |= X86_EFL_IF; 3265 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 3266 if (pIemCpu->uTargetCpu <= IEMTARGETCPU_386) 3257 if (IEM_GET_TARGET_CPU(pIemCpu) <= IEMTARGETCPU_386) 3267 3258 fEFlagsMask &= ~(X86_EFL_AC | X86_EFL_ID | X86_EFL_VIF | X86_EFL_VIP); 3268 #endif3269 3259 uint32_t fEFlagsNew = IEMMISC_GET_EFL(pIemCpu, pCtx); 3270 3260 fEFlagsNew &= ~fEFlagsMask; … … 3339 3329 else if (pIemCpu->uCpl <= NewEfl.Bits.u2IOPL) 3340 3330 fEFlagsMask |= X86_EFL_IF; 3341 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 3342 if (pIemCpu->uTargetCpu <= IEMTARGETCPU_386) 3331 if (IEM_GET_TARGET_CPU(pIemCpu) <= IEMTARGETCPU_386) 3343 3332 fEFlagsMask &= ~(X86_EFL_AC | X86_EFL_ID | X86_EFL_VIF | X86_EFL_VIP); 3344 #endif3345 3333 NewEfl.u &= ~fEFlagsMask; 3346 3334 NewEfl.u |= fEFlagsMask & uNewFlags; … … 4808 4796 case 0: 4809 4797 crX = pCtx->cr0; 4810 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 4811 if (pIemCpu->uTargetCpu <= IEMTARGETCPU_386) 4798 if (IEM_GET_TARGET_CPU(pIemCpu) <= IEMTARGETCPU_386) 4812 4799 crX |= UINT32_C(0x7fffffe0); /* All reserved CR0 flags are set on a 386, just like MSW on 286. */ 4813 #endif4814 4800 break; 4815 4801 case 2: crX = pCtx->cr2; break; … … 4865 4851 */ 4866 4852 uint64_t const uOldCrX = pCtx->cr0; 4853 uint32_t const fValid = X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS 4854 | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM 4855 | X86_CR0_NW | X86_CR0_CD | X86_CR0_PG; 4867 4856 4868 4857 /* ET is hardcoded on 486 and later. */ 4869 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 4870 if (pIemCpu->uTargetCpu >= IEMTARGETCPU_486) 4871 #endif 4872 uNewCrX |= X86_CR0_ET; /* hardcoded on 486+ */ 4873 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 4874 /* The 386 didn't #GP(0) on attempting to set reserved CR0 bits. ET was settable. */ 4858 if (IEM_GET_TARGET_CPU(pIemCpu) > IEMTARGETCPU_486) 4859 uNewCrX |= X86_CR0_ET; 4860 /* The 386 and 486 didn't #GP(0) on attempting to set reserved CR0 bits. ET was settable on 386. */ 4861 else if (IEM_GET_TARGET_CPU(pIemCpu) == IEMTARGETCPU_486) 4862 { 4863 uNewCrX &= fValid; 4864 uNewCrX |= X86_CR0_ET; 4865 } 4875 4866 else 4876 4867 uNewCrX &= X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS | X86_CR0_PG | X86_CR0_ET; 4877 #endif4878 4868 4879 4869 /* Check for reserved bits. */ 4880 uint32_t const fValid = X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS4881 | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM4882 | X86_CR0_NW | X86_CR0_CD | X86_CR0_PG;4883 4870 if (uNewCrX & ~(uint64_t)fValid) 4884 4871 { -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r60664 r60666 976 976 IEM_MC_LOCAL(uint16_t, u16Tmp); 977 977 IEM_MC_FETCH_CR0_U16(u16Tmp); 978 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 979 if (pIemCpu->uTargetCpu > IEMTARGETCPU_386) 978 if (IEM_GET_TARGET_CPU(pIemCpu) > IEMTARGETCPU_386) 980 979 { /* likely */ } 981 else if ( pIemCpu->uTargetCpu>= IEMTARGETCPU_386)980 else if (IEM_GET_TARGET_CPU(pIemCpu) >= IEMTARGETCPU_386) 982 981 IEM_MC_OR_LOCAL_U16(u16Tmp, 0xffe0); 983 982 else 984 983 IEM_MC_OR_LOCAL_U16(u16Tmp, 0xfff0); 985 #endif986 984 IEM_MC_STORE_GREG_U16((bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB, u16Tmp); 987 985 IEM_MC_ADVANCE_RIP(); … … 1018 1016 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm, 0); 1019 1017 IEM_MC_FETCH_CR0_U16(u16Tmp); 1020 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 1021 if (pIemCpu->uTargetCpu > IEMTARGETCPU_386) 1018 if (IEM_GET_TARGET_CPU(pIemCpu) > IEMTARGETCPU_386) 1022 1019 { /* likely */ } 1023 1020 else if (pIemCpu->uTargetCpu >= IEMTARGETCPU_386) … … 1025 1022 else 1026 1023 IEM_MC_OR_LOCAL_U16(u16Tmp, 0xfff0); 1027 #endif1028 1024 IEM_MC_STORE_MEM_U16(pIemCpu->iEffSeg, GCPtrEffDst, u16Tmp); 1029 1025 IEM_MC_ADVANCE_RIP(); … … 8010 8006 { 8011 8007 IEMOP_MNEMONIC("push rSP"); 8012 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC 8013 if (pIemCpu->uTargetCpu == IEMTARGETCPU_8086) 8008 if (IEM_GET_TARGET_CPU(pIemCpu) == IEMTARGETCPU_8086) 8014 8009 { 8015 8010 IEM_MC_BEGIN(0, 1); … … 8021 8016 IEM_MC_END(); 8022 8017 } 8023 #endif8024 8018 return FNIEMOP_CALL_1(iemOpCommonPushGReg, X86_GREG_xSP); 8025 8019 } … … 16391 16385 { 16392 16386 IEMOP_HLP_NO_LOCK_PREFIX(); 16393 #if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC && 016394 if ( pIemCpu->uTargetCpu == IEMTARGETCPU_CURRENT16395 && pIemCpu->CTX_SUFF(pCtx)->cs.Sel <= 1000)16396 {16397 pIemCpu->uTargetCpu = IEMTARGETCPU_286;16398 LogAlways(("\niemOp_hlt: Enabled CPU restrictions!\n\n"));16399 }16400 #endif16401 16387 return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_hlt); 16402 16388 }
Note:
See TracChangeset
for help on using the changeset viewer.